1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

How to shoot the bullet horizonly?

Discussion in 'Programming' started by seojaeoh, Jan 22, 2019.

  1. seojaeoh

    seojaeoh Member

    Joined:
    Jan 22, 2019
    Posts:
    31
    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: Jan 22, 2019
  2. Liam Jacobs

    Liam Jacobs Member

    Joined:
    Jul 1, 2016
    Posts:
    163
    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
     
    seojaeoh likes this.
  3. seojaeoh

    seojaeoh Member

    Joined:
    Jan 22, 2019
    Posts:
    31
    thank you jacobs :)
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice