Jump to content

Recommended Posts

I need some help on a Pong-like game I'm making. This is just a demo so far to make the ball go around like it does on Pong. That means that once it hits the top screen, it goes diagonally down, which I can't seem to make it do. I've tried a bunch of stuff. It's probably something really obvious that I overlooked, but nevertheless, can someone modify this code so that when it hits a side of the screen it bounces diagonally in the opposite direction?

 

1 set smartbranching on
10 ballheight=4 : CTRLPF=$20
12 COLUPF=14
16 x=40 : y=40
20 ballx=x : bally=y
23 if x=150 then goto 35
25 x=x+1
 if x=150 then goto 35
30 goto 40
35 x=x-1
 if x=20 then goto 20
37 goto 40
40 y=y-1
 if y=20 then goto 50
45 goto 55
50 y=y+1
 if y=80 then goto 40
55 drawscreen
60 goto 20

Link to comment
https://forums.atariage.com/topic/89942-pong-like-game/
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.
Note: Your post will require moderator approval before it will be visible.

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