Jump to content
Sign in to follow this  
Arcade

Directional Firing Help *Problem Solved*

Recommended Posts

I was trying out some code to fire missiles using ONLY the joystick (up/down/left/right). I can get the missiles to fire without a problem, however, trying to cancel out the missile (aka make it disappear when you stop pressing a certain direction) is causing problems. I don't like the fact that when I stop pressing a certain direction the bullet just stays on screen until I press another direction again. I want them to disappear whenever I stop firing in a certain direction.

 

If I try something like:

 

if !joy0up then missile0x=0: missile0y=0: a=0

 

Then it will work fine for making the bullet disappear when I stop pressing up...however, pressing any other direction screws up the bullet. The bullets stop traveling and only go 2 to 3 pixles in front instead of firing as before.

 

Is there a way to use up/down/left/right to fire bullets but also be able to make the bullet suddenly disappear when you stop pressing on said direction? I've been tinkering with this for quite some time and I can't seem to get it to work.

Edited by Arcade

Share this post


Link to post
Share on other sites

Yeah I did that but sadly it won't work. I press my two buttons for directional firing and it works except the other three which again just go a few pixels and stay.

Share this post


Link to post
Share on other sites

I actually found the fix! Thanks for your help! I had been using that example for HOURS trying to fix my code for one little thing, then all of a sudden I tried something (out of nowhere) and it worked!

 

Thanks again so much for your help! Seriously, when you posted the example I opened up the file again and found the fix. Had you not posted that it might have took me even more time! Oh man thanks so much!

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...