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

How to shoot the bullet horizonly?

S

seojaeoh

Guest
I've seen a video on YouTube where bullets are generated and fired. But it was launched using the coordinates of the mouse.(instance_create_layer(mouse_x,mouse_y..) Is there a way to shoot a bullet horizontally? :)
 
Last edited by a moderator:

MeBoingus

Member
Hi there! Could you link the tutorial?

I assume (due to lack of information) that the bullets have their 'direction' variable changed, as well as their 'speed' and are rotated + moved accordingly.
If this is the case, you could simply set the direction to 0 (right) or 270 (left - see the chart below for degrees in GM) and then set the speed.

If you want to create the bullet relative to the object firing it, you can use relative coordinates (I.E. instance_create_layer(x + some_value, y + some_value, layer, object))


Here's an image depicting angles in GM (or rather on computers, in general):

download.gif
 
Top