Axl Trauts
Member
Hi,
I am trying several things for this with no luck yet.
I created a shop, where you can buy 1-4 wingmen for the player (a plane). They will go to their respective position: two on the left, one behind the other and the other two on the right, one behind another, like a V formation. When the player moves, their x-y positions will move to keep formation.
I can buy all the four at the same time. They are created on the Draw Event of obj_player like this:
while(M_NUM_ALLY <> num_ally) // M_NUM_ALLY is a macro that points to an array position
{ instance_create(x,y,obj_ally); // The ally object
num_ally++; // a variable created at the start of obj_player to prevent creating infinite instances
break;
}
Now I need to do something on Step like this example:
//for the first ally:
x=obj.player.x+10
y=obj.player.y
//for the second ally:
x=obj.player.x+20
y=obj.player.y+10
//for the third ally:
x=obj.player.x-10
y=obj.player.y
//for the fourth ally:
x=obj.player.x-20
y=obj.player.y+10
But I am missing something about instance_number() somewhere. How can I do this?
I am trying several things for this with no luck yet.
I created a shop, where you can buy 1-4 wingmen for the player (a plane). They will go to their respective position: two on the left, one behind the other and the other two on the right, one behind another, like a V formation. When the player moves, their x-y positions will move to keep formation.
I can buy all the four at the same time. They are created on the Draw Event of obj_player like this:
while(M_NUM_ALLY <> num_ally) // M_NUM_ALLY is a macro that points to an array position
{ instance_create(x,y,obj_ally); // The ally object
num_ally++; // a variable created at the start of obj_player to prevent creating infinite instances
break;
}
Now I need to do something on Step like this example:
//for the first ally:
x=obj.player.x+10
y=obj.player.y
//for the second ally:
x=obj.player.x+20
y=obj.player.y+10
//for the third ally:
x=obj.player.x-10
y=obj.player.y
//for the fourth ally:
x=obj.player.x-20
y=obj.player.y+10
But I am missing something about instance_number() somewhere. How can I do this?