Jump to content



0

Game Frozen


4 replies to this topic

#1 Primordial Ooze OFFLINE  

Primordial Ooze

    Dragonstomper

  • 504 posts
  • Quacker Blaster Lead Programmer
  • Location:United States of America

Posted Tue Oct 28, 2008 3:12 PM

For some reason this code is causing my game to not work. I have checked all the if statements and they are correctly structured. I'm wordering if maybe i'm using too many &&'s on a single line.
   rem 2600 De Amigo
   rem a Samba De Amimo clone for the 2600
   rem Updated: October 11, 2008
   rem Website: http://planetarydefense.freepgs.com

   rem includes
   
   rem 6 lives kernal
   rem include 6lives.asm
  
   rem setup all the game variables
  
   rem variable to hold note direction
   dim notedirection = a
   
   rem set the rom size
   set romsize 2k
  
   rem set the tv format to NTSC
   set tv ntsc
  
   rem turn on smartbranching
   set smartbranching on

   rem kernel options
  
   rem enable no blank lines
   set kernel_options no_blank_lines

   rem set the color of the background to white
   COLUBK = 0
   
   rem set the playfield color to black
   COLUPF = 14

   rem set the score field color
   scorecolor = 128

   rem set the color of the miss counter
   lifecolor = 66

   rem define the playfield
   playfield:
   ................................
   ................................
   ................X...............
   ................................
   ................................
   ................................
   ........X..............X........
   ................................
   ................................
   ................X...............
   ................................
   ................................
end

   rem enable the "High Definition" playfield hack
   pfscroll upup : pfscroll upup

   rem define first note sprite
   player0:
   %00111100
   %00111100
   %00111100
   %00111100
   %00111100
   %00111100
   %00111100
   %00111100
end

	rem start a new game
	
startNewGame

	rem start the player with 0 strikes
	lives = 0
	
	rem define the miss counter
	lives:
	%00000000
	%01000010
	%00100100
	%00011000
	%00011000
	%00100100
	%01000010
	%00000000
end

	rem reset player's score to 0
	score = 0

	rem set first note's inital x position off screen
	player0x = 79
	
	rem set first note's inital y position off screen
	player0y = 51

	rem set the note's initial direction to 0 (none)
	notedirection = 2

gameLoop

	rem if the reset switch is pressed, start a new game
	if switchreset then startNewGame
	
	rem set note's color to white
	COLUP0 = 14

	rem move the note cue based on the notes direction
	
	rem if notedirection is 1(up) move the note cue up
	if notedirection = 1 then player0y = player0y - 1
	
	rem if notedirection is 2(down) move the note cue down
	if notedirection = 2 then player0y = player0y + 1
	
	rem if notedirection is 3(left) move the note cue left
	if notedirection = 3 then player0x = player0x - 1
	
	rem if notedirection is 4(left) move the note cue right
	if notedirection = 4 then player0x = player0x + 1
	
	rem if the notedirection is up(1) and thejoystick is
	rem up while it is colliding with the playfield
	rem give the user points and move the arrow back
	rem to the center
	if collision(player0, playfield) && joy0up && notedirection = 1 then score = score + 1:player0x = 79:player0y = 51

	rem if the player misses the up note then give the
	rem player a miss and move the arrow back to the center
	if player0y > 16 then lives = lives + 32:player0x = 79:player0y = 51

	rem if the notedirection is down(2) and the joystick is
	rem down while it is colliding with the playfield
	rem give the user points and move the arrow back
	rem to the center
	if collision(player0, playfield) && joy0down && notedirection = 2 then score = score + 1:player0x = 79:player0y = 51

	rem if the player misses the down note then give the
	rem player a miss and move the arrow back to the center
	if player0y < 78 then lives = lives + 32:player0x = 79:player0y = 51

	rem if the notedirection is left(3) and the joystick is
	rem left while it is colliding with the playfield
	rem give the user points and move the arrow back
	rem to the center
	if collision(player0, playfield) && joy0left && notedirection = 3 then score = score + 1:player0x = 79:player0y = 51

	rem if the player misses the left note then give the
	rem player a miss and move the arrow back to the center
	if player0x > 44 then lives = lives + 32:player0x = 79:player0y = 51

	rem if the notedirection is right(4) and the joystick is
	rem rightt while it is colliding with the playfield
	rem give the user points and move the arrow back to
	rem the center
	if collision(player0, playfield) && joy0right && notedirection = 4 then score = score + 1:player0x = 79:player0y = 51

	rem if the player misses the rightt note then give the
	rem player a miss and move the arrow back to the center
	if player0x < 109 then lives = lives + 32:player0x = 79:player0y = 51

	rem if the player misses 3 times it's game over
	if lives > 128 then gameOver

	rem draw the screen
	drawscreen
	
	goto gameLoop

	rem Game Over Screen
gameOver

gameOverLoop
	rem if the reset switch is pressed, start a new game
	if switchreset then startNewGame

	rem if the joystick fire button is pressed start a new game
	if joy0fire then startNewGame
	
	rem set first note's color to white
	COLUP0 = 14
	
	rem draw the screen
	drawscreen

	goto gameOverLoop
Please take a look and let me know what you find.

Sincerely,

Open Source Pong

#2 Random Terrain ONLINE  

Random Terrain

    Visual batari Basic User

  • 20,911 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Tue Oct 28, 2008 6:17 PM

If you'd post the .bas file too, it would be a lot easier for people to check. Instead of needing to copy your code, make a blank file, paste your code, then save it, they could just download your program and immediately get to work on it. Also, that web site mentioned in your code is no longer available.

Now to the problem. You don't have any code that actually checks the joystick (except for when it's tied to collision detection).

#3 Primordial Ooze OFFLINE  

Primordial Ooze

    Dragonstomper

  • 504 posts
  • Quacker Blaster Lead Programmer
  • Location:United States of America

Posted Tue Oct 28, 2008 6:29 PM

Fixed, i reversed the lines that deal with the player missing the note and it when the player started a game the player would automatically lose. I reverse the comparison and now it works.

Small problem though, for some reason the lives counter isn't showing up in the game. I did everything required to make the lives counter work and it won't show. Any ideas?

Sincerely,

Open Source Pong

P.S. This time i attached the .bas file for reference.

Edited by Open Source Pong, Tue Oct 28, 2008 6:38 PM.


#4 Random Terrain ONLINE  

Random Terrain

    Visual batari Basic User

  • 20,911 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Tue Oct 28, 2008 7:32 PM

Notice anything funny here:

   rem include 6lives.asm

:D


Thanks for posting the .bas file. Makes it a lot easier.

#5 Primordial Ooze OFFLINE  

Primordial Ooze

    Dragonstomper

  • 504 posts
  • Quacker Blaster Lead Programmer
  • Location:United States of America

Posted Wed Oct 29, 2008 7:18 AM

Silly me, what a dumb mistake. Thanks and welcome.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users