GM: with

From GMpedia.org Wiki

Jump to: navigation, search

with (expression)
 

Type: statement
Limitations: none
The correct title of this article is with (expression). It appears incorrectly here because of technical restrictions.
with (expression)
{
 coding;
}

The with statement simply executes coding with the object specified after the keyword with, as if it were expression. expression must be either an id, an object name, or a special object (all, self, other, noone). The with statement is very useful, and shouldn't be forgotten. coding is either executed for nothing, an instance, an object, everything, itself, or another (what we are in collision with).

[edit] Example

with (obj_enemy01)
{
 // This will destroy the object obj_enemy01.
 instance_destroy;
}

[edit] See Also

This article was originally found at the Game Maker Knowledge Base, contributed by Abyssal_Nuclei.
See the talk page for details
Personal tools