• 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!

Spawn object on the side of another object

P

PhilipMoss

Guest
Hello I am trying to spawn on object on the side of another object that rotates with the mouse?
I want it so it always spawns on that side no matter what the rotation the other object is

Any tips on how to do this?
 

TheouAegis

Member
Look up lengthdir_x and lengthdir_y in the manual.

The "dir" argument is your image_angle of the main object. The "length" argument is how far from the origin of the main object the new object would spawn when image_angle is 0.

Add the resultant vectors to x and y of the main object, respectively.

The two functions are essentially length*dcos(dir) and length*dsin(dir).
 
Top