Jump to content

Photo

Making my first bAtari Basic game

help debugging

9 replies to this topic

#1 Robsome OFFLINE  

Robsome

    Combat Commando

  • 6 posts

Posted Fri Jun 2, 2017 9:19 PM

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


#2 Robsome OFFLINE  

Robsome

    Combat Commando

  • Topic Starter
  • 6 posts

Posted Fri Jun 2, 2017 9:57 PM

I'm sorry I meant line 2


Edited by Robsome, Fri Jun 2, 2017 10:02 PM.


#3 Robsome OFFLINE  

Robsome

    Combat Commando

  • Topic Starter
  • 6 posts

Posted Fri Jun 2, 2017 10:23 PM

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


#4 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,013 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Fri Jun 2, 2017 10:55 PM

If you attach your file, it will be easier for us to deal with it.



#5 Robsome OFFLINE  

Robsome

    Combat Commando

  • Topic Starter
  • 6 posts

Posted Fri Jun 2, 2017 11:32 PM

Here's the most current version. 

Attached Files



#6 kdgarris OFFLINE  

kdgarris

    Chopper Commander

  • 129 posts

Posted Sat Jun 3, 2017 3:59 AM

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

http://www.randomter...nds.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.

#7 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,013 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Jun 3, 2017 8:00 AM

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

 

Attached File  robsome_2017y_06m_03d_0947t.bas   1.61KB   13 downloads

 

Attached File  robsome_2017y_06m_03d_0947t.bin   4KB   14 downloads

 

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

 

Indent!

 

dim

 

Boolean Operators



#8 Robsome OFFLINE  

Robsome

    Combat Commando

  • Topic Starter
  • 6 posts

Posted Mon Jun 5, 2017 3:05 PM

Thank you! your advise worked wonderfully.

 

But this file compiles but I get errors running it through emulators.

 

Attached Files



#9 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,013 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Mon Jun 5, 2017 3:20 PM

You have "sco4e=score+1"



#10 Robsome OFFLINE  

Robsome

    Combat Commando

  • Topic Starter
  • 6 posts

Posted Mon Jun 5, 2017 6:45 PM

Thank you







Also tagged with one or more of these keywords: help, debugging

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users