Shooting with Vector to angle (but hero rotation throws it off!)

floydianspiralfloydianspiral Member, PRO Posts: 308
edited November -1 in Working with GS (Mac)
I'm trying to have my hero shoot vector to angle where 2nd touch XY is...this works fine if the hero is not rotating but in my game the hero is constantly being rotated and the shots only come out of the front of him. This leads to people trying to shoot one direction but because the hero is facing the other direction it won't work...help!

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    If you are spawning your bullets then use relative to your actor instead of scene.

    If you are recycling bullets then you could constrain the player rotation to a game attribute and when you change the bullets to the players position to be fired change the bullet rotation to match the player. and it should fire out in front of him either way.

    Hope that helps you.

    Aaron

    ___________________________________________________________________________________
    Project Help from Tenrdrmer Click Here

    GS BubbleBall Template HERE!!
    Stacks Level Selection Template HERE!!
    Expanding Option Menu Template HERE!!
    Tenrdrmer's Menu # 3 HERE!!
    Menu #4 - Level Banners HERE!!
    AppSolute Entertainment on Facebook
    AppSolute Entertainment on iTunes
  • floydianspiralfloydianspiral Member, PRO Posts: 308
    @TSB, I wish I could show a video but its using the second touch XY so I can't do it on the gamesalad previewer...if you can imagine a ball rotating and then trying to spawn bullets toward a cordinate, it will do it fine but if someone tries to fire in the opposite way the ball is "facing" then it just fires the way it's facing, not in the correct direction

    @tenrdrmer, I'm spawning my bullets relative to my actor already...like I said it can shoot in any direction if my actor is not moving or if the player fires the way my actor faces, but I want the player to be able to fire in any direction at ANY time, regardless of rotation, is there a way to negate the Hero's rotaton perhaps?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Oh well in that case try relative to scene I thought you wanted him to always fire forward.
  • floydianspiralfloydianspiral Member, PRO Posts: 308
    I tried a couple ways but if I can't get it by tonight I'm going to give up and think of a different weapon, If I do relative to scene it will spawn at the scene origin and then accelerate toward touchXY but that looks silly
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    floydianspiral said:
    I tried a couple ways but if I can't get it by tonight I'm going to give up and think of a different weapon, If I do relative to scene it will spawn at the scene origin and then accelerate toward touchXY but that looks silly

    no you have to set the x and y points for the spawn to happen from self.position.x and self.position.y of the hero
  • floydianspiralfloydianspiral Member, PRO Posts: 308
    I can't believe I didn't think of that, thanks man, totally works! I'm assuming I have to account for offset of that too...
Sign In or Register to comment.