[Solved]Stop shooting in all directions

0 favourites
  • 5 posts
From the Asset Store
Character Sprite Pack: Walk 4 Directions made in illustrator
  • Hello Guru's,

    I need a bit of help dealing with some events to stop my player from shooting in all directions when the fire button is pushed. I currently have it set to shoot in four directions using the arrow keys to fire ie: pressing upArrow shoots 270deg downArrow shoots 90deg etc. The player uses the WASD keys to move. Now onto my issue. I have been learning about using a delay on the fire mechanic to allow for my player to simulate loading a round into the chamber. Upon implementing this, I now have an issue with when you hold down 2 keys simultaneously, the player will shoot in both directions. This is impractical for how I would like to use it and I have been struggling trying to understand this for about 6 hours now. As I mentioned in my introduction post, I was a soldier for 12 years and this is my first project other than the tuts I have taken to familarize myself with things. Please take it easy on me I have provided a screen capture of the events I am using and can provide the cap if needed. Need some help on this one guys my NOOB brain just cant understand what I am doing wrong. I have tried using Local vars to simulate a boolean but no luck please let me know if I am on the right track here Ladies and gents

    i.imgur.com/sf8DrC8.png

    Respectfully,

    ~Nite

  • Well one way would be to make variable "shootDirection" for the player and when pressin down set 90 etc. And then use or condition.

    when right pressed

    -or-

    when down pressed

    -or-

    when left pressed

    -or-

    when up pressed

    ->

    Spawn bullet to player

    Set bullet angle to shootDirection

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you for your help Katala but I am unsure I understand what your implying. Excuse my noobness :D. I think I have tried what you are suggesting.. This setup still does not work. I feel like I am doing something wrong, or I am just missing a step.I have also included a screen capture of what the player is doing when you hold down all the arrow keys. You can see that he is shooting in all four directions. Your help is greatly appreciated. Thank you again

    http: //i.imgur.com/P6NWM0S.png

    http: //i.imgur.com/j8tKWQE.png

    ~Nite

  • Sorry my explanation was't the best. I can't open your images but I took one from what I mean.

    Something like this

    <img src="https://dl.dropboxusercontent.com/u/104893773/C2%20examples/one%20direction%20shoot.png" border="0" />

  • Katala you are the man , such a simple solution I was over thinking and made this way more difficult then it should have been. You rock man

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)