0
\$\begingroup\$

Alright, I'm looking how to create an instance, and then run a chunk of code on the instance I just created, and not have that code run on any other duplicate instances.

Noob question, I know. Please help though?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

There are many ways. For example:

with instance_create(posx, posy, obj_enemy)
{
    direction = choose(0, 90, 180, 270);
    speed = 4;
}

Or you may separate creation and code:

var obj = instance_create(posx, posy, obj_enemy);
...
with obj
{
    direction = choose(0, 90, 180, 270);
    speed = 4;
}
\$\endgroup\$
1
  • \$\begingroup\$ This answer is genius! +1 I never considered using this as a method. I always only set variables and just do obj.var = var2; :p \$\endgroup\$
    – user64742
    Oct 25, 2016 at 5:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .