GMS 2 Platformer gun not firing at certain angles when on ground (Resolved)

Discussion in 'Programming' started by Rahiokawines, Aug 30, 2019.

  1. Rahiokawines

    Rahiokawines Member

    Joined:
    Aug 30, 2019
    Posts:
    4
    I have this problem where my bullets (Ninja Stars) will not fire when on the ground, specifically when I'm pointing to the right. I've tried changing the size of the bullets, but it showed little difference. Please help!

     
  2. the_dude_abides

    the_dude_abides Member

    Joined:
    Jun 23, 2016
    Posts:
    626
    A rough guess would be that the bounding box for your "bullet" is large enough that when fired horizontally it is colliding with objects and being destroyed immediately, but that wouldn't explain why you don't have that problem when facing left.

    You're going to have to post your code, and some details about how your game is organised, for anyone to figure it out. Or do a link to the game files through something like dropbox or onedrive etc.

    I'd take a look but don't use GMS 2, so at least for me you'd have to export it as GMS 1 (I think - definitely had some troubles loading GMS 2 files)
     
  3. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,902
    Make sure the origin of your ninja star Sprite is centered. It looks to me like you have the origin set at the default (0,0), which DOES explain why it shoots left but not right.
     
  4. the_dude_abides

    the_dude_abides Member

    Joined:
    Jun 23, 2016
    Posts:
    626
    I'm curious how that makes a difference, as it seems like there are times where they're firing at angles slightly larger than, or equal to, zero, and slightly less / equal to 180 degrees while on platforms. Your point is that the origin is maybe top left - unless they are rotating the sprite, and changing the bounding box to be longer vertically, then why does pointing to the right make a collision?

    If it's at zero degrees, or larger, and is not being rotated, then doesn't it start travelling from the same height regardless of the side fired from?
     
  5. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,902
    He's changing image_angle of the shuriken. So when he's shooting to the right, the bbox is below the shuriken and when shooting left it's above. What else is below the shuriken? Ground.
     
  6. Rahiokawines

    Rahiokawines Member

    Joined:
    Aug 30, 2019
    Posts:
    4
    Thanks to all that have replied, it turns out my origin point was off and the collision mask was off. Thanks!
     

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