Jump to content
IGNORED

breakout clone


ravenxau

Recommended Posts

I'd love to see it, too, but it doesn't appear to be anywhere on the page, so I made my own sans blocks. Unless someone's willing to post it on here, I guess this'll have to do.

12 player1:
 %1111111
 %1111111
end
15 x=60 : y=40 : c=140 : d=80 : score=5 : scorecolor=128
20 a=0 : b=0
41 missile0x=x : missile0y=y : player1x=c : player1y=d : missile0height=4 : NUSIZ0=$20
42 COLUP0=64 : COLUBK=0 : COLUP1=30
45 drawscreen
50 if a=0 then y=y+1
 if y=85 then goto 150
60 if b=0 then x=x+1
 if x=160 then b=1
70 if a=1 then y=y-1
 if y=20 then a=0
80 if b=1 then x=x-1
 if x=20 then b=0
90 if joy0left then c=c-2
 if c<20 then c=20
 if collision(missile0,player1)  then a=1
100 if joy0right then c=c+2
 if c>160 then c=160
 if collision(missile0,player1)  then a=1
140 goto 41

150 score=score-1
160 goto 41

Edited by atari2600land
Link to comment
Share on other sites

I wrote that. It was the first build of bB that Batari released. I'm not sure the code would run, unchanged in more recent versions of bB.

 

The machine I wrote it on is not up at the moment. I've got to power it up anyway for some unrelated things, I'll go digging to see what I find.

Link to comment
Share on other sites

Here is that old version. Took a while to track down the post.

 

http://www.atariage.com/forums/index.php?s...72428&st=50

 

1 rem smartbranching on

5 AUDC0 = 12 : AUDF0 = 3

10 x = 50 : y = 90 : w = rand : v = 60

11 d = 1 : e = 255 : f = 0 : g = 0 : h = 1 : i = 0 : j = 0 : k = 0 : l = 0

12 if w > 100 then w = 100

14 if w < 40 then w = 40

20 COLUPF = 54 : COLUBK = 17

22 pfhline 0 2 31 on

23 pfhline 0 3 31 on

30 COLUP0 = 120 : player0x = x : player0y = y : l = l - 1

40 scorecolor = 10

45 player0:

%01000010

%11111111

%11111111

%00000000

end

46 player1:

%00011000

%00111100

%01111110

%00111100

%00011000

end

47 a = a + 1 : if a < 3 then 90

49 a = 0 : i = INPT4

51 w = w + d : v = v + e

52 if l = 0 then l = 4 : w = w - d

64 player1x = w : player1y = v

65 pfvline 0 0 11 on

66 pfhline 0 0 31 on

67 pfvline 31 0 11 on

68 pfhline 0 11 31 on

69 AUDV0 = 0

90 drawscreen

92 f = x + 250 : g = x + 5

93 if CXP1FB < 64 then 154

94 if l = 1 then 154

110 j = w - 28 : j = j / 2 : j = j / 2

112 pfpixel j 3 off : l = 1

118 AUDF0 = 58 : h = 1

130 if e = 1 then e = 255

134 if e = 255 then e = 1

154 if v > 88 then 159

157 goto 173

159 e = 255 : h = 1 : l = 0

160 if w < f then e = 1 : h = 0 : AUDF0 = 50

162 if w > g then e = 1 : h = 0 : AUDF0 = 50

173 if v < 15 then e = 1 : h = 1 : AUDF0 = 40 : l = 0

175 if w > 148 then d = 255 : h = 1 : AUDF0 = 70 : l = 0

177 if w < 35 then d = 1 : h = 1 : AUDF0 = 70 : l = 0

179 if h = 1 then h = 0 : AUDV0 = 15

180 if joy0left then x = x - 1

190 if joy0right then x = x + 1

195 if i < 15 then 5

200 goto 30

 

This was waay back in bB history. Line numbers required, only simple expressions allowed, etc.... Maybe I'll do this again with the latest version.

Link to comment
Share on other sites

93 if CXP1FB < 64 then 154

 

I didn't see any DIM statements, what in the world is CXP1FB?

 

That's a collision register. All of the key memory addresses has a label like this. Sometimes, it's easier to just use the label than anything else.

 

Here is one list of them, I know there are others:

 

http://alienbill.com/2600/101/docs/stella.html

 

There are things that happen in the 2600, such as a bit getting set when the playfield and a player overlap. Those bits exist at the memory addresses defined by the label.

 

The statement in the sample game checks to see if a player (the ball shape) touches the playfield. If it does, then the brick closest to the ball (based on it's xy coordinates) is removed.

Edited by potatohead
Link to comment
Share on other sites

I'm working on a new one now. Would it be easier to program a Breakthru (where the ball keeps going after it hits a block) or Breakout (where the ball comes down after it hits a block)? Also, how do you get bBASIC to know when a block gets hit and to remove it from the playfield?

blox.bas.bin

blox.bas

Link to comment
Share on other sites

I'm working on a new one now. Would it be easier to program a Breakthru (where the ball keeps going after it hits a block) or Breakout (where the ball comes down after it hits a block)? Also, how do you get bBASIC to know when a block gets hit and to remove it from the playfield?

 

Use the collision registers. The 2600 will tell you, by setting a bit in one of them, when your ball object hits your brick object.

 

If {register from the list I linked above} = some value, then gosub get_rid_of_block.

 

Once you have detected the collision, then you need to compare the position of the ball to where the blocks are and erase one.

 

This is going to take some math, typically dividing the ball position by something to get the x block number for the pfpixel command.

 

bB has collision commands, take a look at them.

 

Do something goofy, like change the color of the ball first, to let you know you have successfully detected the collision state, then work on getting rid of the blocks.

Link to comment
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...