Jump to content
IGNORED

Making my first bAtari Basic game


Robsome

Recommended Posts

I am trying to make a game for the 2600 and I am also learning BASIC. Every time I try to compile this, it says I have a syntax error on the first line.

If you want an idea of how much programming I know, I've taken 2 programming programs and I've worked with C++ and a little C#. But I only used C# for making a Unity game.

COLUPF = 128
COLUBK=02
scorecolor = 14

player0:
 %00000000
 %00110110
 %00100100
 %10111100
 %01111111
 %00000110
 %00000110
 %00000000
end

player0x =50 
player0y =50

player1:
 %01111100
 %00111100
 %00001100
 %00001100
 %00001100
 %00001100
 %00001100
 %00001100
 %01111100
 %11101100
 %00010010
 %00100011
 %00111011
 %00101111
 %00011110
 %00001100
end
 player1x=100
 player1y=35

dim cute = 0

mainloop

playfield:
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 XX............................XX
 XX............................XX
 XX............................XX
 XX............................XX
 XX............................XX
 XX............................XX
 XX............................XX
 XX............................XX
 XX............................XX
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end

 if collision(player0, player1) then cute = 1
 if joy0right then player0x=player0x+1
 if joy0right &&  cute == 0 then  player0:
 %00000000
 %00110110
 %00100100
 %10111100
 %01111111
 %00000110
 %00000110
 %00000000
end
 if joy0right &&  cute == 1 then player0:
 %00000000
 %01101100
 %00100100
 %00111101
 %11111110
 %01100000
 %01100000
 %00000000
end
 if joy0left then player0x=player0x-1
 if joy0left then player0:
 %00000000
 %01101100
 %00100100
 %00111101
 %11111110
 %01100000
 %01100000
 %00000000
end
 if joy0up then player0y=player0y-1
 if joy0down then player0y=player0y+1
 drawscreen
 goto mainloop
Link to comment
Share on other sites

I edited the loop. It now says a syntax error on line 91.

mainloop

 playfield:
  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  XX............................XX
  XX............................XX
  XX............................XX
  XX............................XX
  XX............................XX
  XX............................XX
  XX............................XX
  XX............................XX
  XX............................XX
  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end

 if collision(player0, player1) then cute = 1
 if joy0right then player0x=player0x+1
 if joy0right &&  cute == 0 then  player0:
  %00000000
  %00110110
  %00100100
  %10111100
  %01111111
  %00000110
  %00000110
  %00000000
end
 if joy0right &&  cute == 1 then player0:
  %00000000
  %01101100
  %00100100
  %00111101
  %11111110
  %01100000
  %01100000
  %00000000
end
 if joy0left then player0x=player0x-1
 if joy0left then player0:
  %00000000
  %01101100
  %00100100
  %00111101
  %11111110
  %01100000
  %01100000
  %00000000
end
 if joy0up then player0y=player0y-1
 if joy0down then player0y=player0y+1
 drawscreen
 goto mainloop
Link to comment
Share on other sites

Everything except for labels and the end statement needs to be indented by at least one space:

 

http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#labels

 

This includes the player0 and player1 definitions - only the end statement should not be indented.

 

COLUBK=02

 

If you are intending this to be a hex value, it needs to be preceeded by a $ character.

 

if joy0right && cute==1 then player0:

 

The comparison operator is the same as the assignment operator in bB as well as most BASIC dialects - a single equal sign.

 

I'm not near a computer to try to compile your code with these changes, but this is what I was able to find at first glance.

Link to comment
Share on other sites

Yeah, what he said. You didn't indent and you had a few other problems:

 

robsome_2017y_06m_03d_0947t.bas

 

robsome_2017y_06m_03d_0947t.bin

 

Here are some sections on the bB page that you'll want to look at:

 

Indent!

 

dim

 

Boolean Operators

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