• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Simultaneous instance create

jf_knight

Member
I'm trying to implement a hit-scan shotgun. Every instance...
Code:
instance_create(x+lengthdir_x(length,direction ),y+lengthdir_y(length,direction ),projectile)
...creates one "hit-scan line". I would like to use 5 or 6 at once, however an instance is created one after another and not at the same time. What can I do so that 5 instances happen at the same time? I've tried using an "AND" after each line but to no avail.


I'm not too familiar with alarms, but is it possible to have a millisecond pause and wait until all the hit-scans are "loaded" and then have them created at once?
 

HayManMarc

Member
Code:
repeat(5)
  {
     instance_create(x+lengthdir_x(length,direction ),y+lengthdir_y(length,direction ),projectile);
   }
Note that each of the 5 instances will be placed in the exact same position.
 

jf_knight

Member
Code:
repeat(5)
  {
     instance_create(x+lengthdir_x(length,direction ),y+lengthdir_y(length,direction ),projectile);
   }
Note that each of the 5 instances will be placed in the exact same position.
I'm one step closer! You're right, they do all align. There is also a small dip in fps when I press the "shoot" button rapidly signifying that the collision detection is registering.
Now if only I can add some random number variation to the "direction " property...
 
There's a function for that, called random(), also random_range() and if you just want integers, irandom() and irandom_range()
 
Top