Legacy GM Projectile with relative Direction. SOLVED

Null-Z

Member
I want to code a burst projectile. it will start as a separate projectile and once it hits a ground object it creates a bloom of smaller projectiles that spread out in 8 directions. now, coding the initial phase won't be a problem, just a matter of using the right loop to create the projectiles.

what I'd like to learn is what ways can I make one object be able to move in a relative direction. because I'd rather not make eight of the same objects, for each specified direction.
 

FrostyCat

Redemption Seeker
Learn the difference between an object and an instance, and put that to work on a for loop.
Created or copied instance. instance_create() (GMS 1.x and legacy) / instance_create_layer() (GMS 2.x) and instance_copy() return the ID of the created or copied instance. NEVER use instance_nearest() to establish this relationship --- something else could be closer by.
Code:
for (var i = 0; i < 8; i++) {
  var inst = instance_create_layer(x, y, layer, obj_bullet);
  inst.direction = direction+45*i;
}
 
Top