Jump to content
Retro Lord

Can't figure out what I did wrong with my code

Recommended Posts

I'm stumped at this one. I want to be able too fire left and right. I can fire right but not left, how come?

The k is simply for making sound and is not really relevant.

 if ballx>135 then ballx=200 : bally=200 : goto skip
 if ballx<10 then ballx=200 : bally=200 : goto skip2
 if bally>90 then ballx=200 : bally=200 : goto skip
 if ballx<10 then ballx=200 : bally=200 : goto skip2

 if joy0right && joy0fire goto SHOOTRIGHT
 if joy0left && joy0fire goto SHOOTLEFT


SHOOTRIGHT
  ballx = ballx+2:goto draw_loop
skip
 if joy0fire && joy0right then k=10 : ballx = missile1x:bally=missile1y-5

SHOOTLEFT
  ballx = ballx-2:goto draw_loop
skip2
 if joy0left && joy0fire then k=10 : ballx = missile1x:bally=missile1y-5



draw_loop

  goto main

Share this post


Link to post
Share on other sites

Looks like the program is constantly running over ballx = ballx + 2.

 

Also, do you only want the ball to move if the player is pressing the joystick in a certain direction while pressing the fire button? In most games, pressing the fire button to start the shot is all that is needed:

 

randomterrain.com/atari-2600-memories-batari-basic-commands.html#sprite_missile_example

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...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...