IGNORED

# Batari Street Racer almost done

## Recommended Posts

All I have to do is figure out how to make a the same number until it gets to the point of colliding with x or not. Can someone show me what the code is and where to put it? Here's the code. BTW, everything is indented properly in the program. I put the - to mean a space because I don't know how to copy code from 2600ide to here.

==========

beginning

-set smartbranching on

-x = 20 : y = 70 : b = 10

-score = 0 : scorecolor = 196

-player0:

-%111111

-%111111

-%001100

-%001100

-%111111

-%111111

-%001100

-%001100

end

-player1:

-%001100

-%001100

-%111111

-%111111

-%001100

-%001100

-%111111

-%111111

end

mainloop

-COLUPF = 0 : COLUBK = 0 : COLUP0 = 128 : COLUP1 = 64

-a = rand

--if a > 85 || a = 85 then a = 20

--if a > 170 || a = 170 then a = 30

--if a > 171 || a = 255 then a = 40

-player0x = x : player0y = y : player1x = a : player1y = b

-if joy0left then x = x - 1

--if x<20 then x=20

--if x>40 then x=40

-if joy0right then x = x + 1

--if x<20 then x=20

--if x>40 then x=40

-b = b + 1

-if b = 111 then b = 0

-if player1y = 70 then score = score + 1

-if collision(player0, player1) then score = 0 : goto death

-drawscreen

-goto mainloop

death

-drawscreen

-AUDV0 = 12 : AUDC0 = 15 : AUDF0 = 6

death2

-if !switchreset then goto death

================

Edited by atari2600land
##### Share on other sites

I put the - to mean a space because I don't know how to copy code from 2600ide to here.

Check the pinned thread with the title "Code Cleaner Tool" at the top of this forum.

##### Share on other sites

Here it is again:

```beginning
set smartbranching on

x = 20 : y = 70 : b = 10

score = 0 : scorecolor = 196

player0:
%111111
%111111
%001100
%001100
%111111
%111111
%001100
%001100
end
player1:
%001100
%001100
%111111
%111111
%001100
%001100
%111111
%111111
end

mainloop

COLUPF = 0 : COLUBK = 202 : COLUP0 = 86 : COLUP1 = 150

a = rand
if a > 85 || a = 85 then a = 20
if a > 170 || a = 170 then a = 30
if a > 171 || a = 255 then a = 40

player0x = x : player0y = y : player1x = a : player1y = b

if joy0left then x = x - 1
if x<20 then x=20
if x>40 then x=40
if joy0right then x = x + 1
if x<20 then x=20
if x>40 then x=40

b = b + 2
if b = 111 then b = 0

if player1y = 70 then score = score + 1
if collision(player0, player1) then score = 0 : goto death

drawscreen

goto mainloop

death
drawscreen
AUDV0 = 12 : AUDC0 = 15 : AUDF0 = 6
death2
if !switchreset then goto death
```

Edited by atari2600land
##### Share on other sites

All I have to do is figure out how to make a the same number until it gets to the point of colliding with x or not. Can someone show me what the code is and where to put it?

Here's a revised version of your code that fixes the problem with the enemy cars. They'll now travel a straight track until scrolling off the bottom of the screen.

Steve

```beginning
set smartbranching on

x = 40 : y = 70 : a = 40: b = 2

score = 0 : scorecolor = 196

player0:
%111111
%111111
%001100
%001100
%111111
%111111
%001100
%001100
end
player1:
%001100
%001100
%111111
%111111
%001100
%001100
%111111
%111111
end

mainloop

COLUPF = 0 : COLUBK = 202 : COLUP0 = 86 : COLUP1 = 150

if b < 99 then skipr
a = rand
if a >= 85  && b>99 then a = 49:s=0
if a >= 170 && b>99 then a = 53:s=0
if a >= 255 && b>99 then a = 59:s=0
skipr
b=b+1
player0x = x : player0y = y : player1x = a : player1y = b

if joy0left then x = x - 1
if x<37 then x=37
if x>70 then x=70
if joy0right then x = x + 1
if x<37 then x=37
if x>70 then x=70

rem if b = 111 then b = 0

if player1y = 70 then score = score + 1
if collision(player0, player1) then score = 0 : goto death

pfpixel 1 1
pfpixel 14 1
pfscroll down

drawscreen

goto mainloop

death
drawscreen
AUDV0 = 12 : AUDC0 = 15 : AUDF0 = 6
death2
if !switchreset then goto death
```

##### Share on other sites

Thanks ## 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. ×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.