Jump to content
IGNORED

Can anyone please help me?


STGraves

Recommended Posts

Well I'm currently developping a simple atari game, I want to add a deadscreen, I've added it but i haven't been capableto make it appear after you die on the game, here is the conde, can anyone help me please?

 

 

 

rem Generated 1/4/2010 1:48:01 PM by Visual bB Version 1.0.0.548

rem **********************************

rem *<Tinkernut World> *

rem *<Shoot the squirrel before he *

rem *eats you.> *

rem *<admin@tinkernut.com> *

rem *<www.tinkernut.com> *

rem **********************************

 

rem Create the dead screen

deadscreen

 

playfield:

.............XX.................

............XXXX................

.............XX.................

.........XXXXXXXXXX.............

........XX........XX............

........XXXXX.X..XXX............

........XX.X..X..XXX............

........XX.X...XX.XX............

........XX........XX............

........XX........XX............

........XX........XX............

end

 

 

 

 

rem Create the title screen

opening

 

playfield:

.XX.XXX.XX..XXX...XX..X.X.XXX.XX

X....X.X....X..X.X..X.X.X.X..X..

.X...X.X.XX.XXX..XXXX.X.X.XX..X.

..X..X.X..X.X.X..X..X.X.X.X....X

XX...X..XX..X..X.X..X..X..XXX.XX

................................

....X...X.XXXX.XXX..X...XXX.....

....X...X.X..X.X..X.X...X..X....

....X...X.X..X.XX...X...X..X....

....X.X.X.X..X.X.X..X...X..X....

....XX.XX.XXXX.X..X.XXX.XXX.....

end

 

 

 

rem Loop the screen until the spacebar is pressed

title

COLUBK = $00

COLUPF = $0E

drawscreen

if joy0fire || joy1fire then goto skiptitle

goto title

 

rem This function displays after the title is skipped

skiptitle

 

rem Colors

COLUPF = $40

COLUBK = $60

COLUP0 = 222

 

rem Player location

player0x = 50 : player0y = 50

player1x = 20 : player1y = 20

 

rem Score setting and color

score = 0 : scorecolor = $F8

 

rem Missle size and location

missile1height=6:missile1y=255

NUSIZ0 = 25

 

rem Create a variable to keep up with lives

a = 5

 

rem Create the playfield

 

 

playfield:

..XX..XX..XX..XX..XX..XX..XX..XX

XX..XX..XX..XX..XX..XX..XX..XX..

..XX..XX..XX..XX..XX..XX..XX..XX

XX..XX..XX..XX..XX..XX..XX..XX..

..XX..XX..XX..XX..XX..XX..XX..XX

XX..XX..XX..XX..XX..XX..XX..XX..

..XX..XX..XX..XX..XX..XX..XX..XX

XX..XX..XX..XX..XX..XX..XX..XX..

..XX..XX..XX..XX..XX..XX..XX..XX

XX..XX..XX..XX..XX..XX..XX..XX..

..XX..XX..XX..XX.XXX..XXX.XX..XX

end

 

 

 

 

 

rem This main function is what loops constantly

main

 

rem This is the animation function

animate

rem This frame variable slows down the animation

v = v + 1

 

rem This code animates the sprites

if v = 7 && w = 0 then ax

if v = 7 && w = 1 then bx

if v = 7 && w = 2 then cx

if v = 7 && w = 3 then dx

 

goto nextstep

 

rem These four sprites are different stages of the animation

ax

v = 0

w = 1

 

player1:

%00011000

%01111110

%01111110

%01111110

%00100100

%11000011

%01000010

%11000011

end

 

 

goto nextstep

 

bx

v = 0

w = 2

 

player1:

%00011000

%01111110

%01111110

%01111110

%00100100

%11000011

%01000010

%11000011

end

 

 

 

goto nextstep

 

cx

v = 0

w = 3

 

player1:

%00011000

%01111110

%01011010

%01111110

%00100100

%11000011

%01000010

%11000011

end

 

goto nextstep

 

dx

v = 0

w = 0

player1:

%00011000

%01111110

%01011010

%01111110

%00100100

%11000011

%01000010

%11000011

end

 

goto nextstep

 

rem Create acorn sprite

nextstep

 

 

 

player0:

%01111110

%01000010

%01011010

%11000010

%01100111

%11111110

%01010101

%10010010

end

 

 

rem check to see if a missile has already been fired

checkfire

if missile1y>100 then goto skip

missile1y = missile1y - 2 : goto draw

 

rem if a missile hasn't been fired, then fire missile

skip

if joy0fire then missile1y=player0y-2:missile1x=player0x+4

 

rem Draw output to screen

draw

drawscreen

 

rem Fix player wraparound bug

if player0x < 8 then player0x = 8

if player0x > 150 then player0x = 150

if player0y < 8 then player0y = 8

if player0y > 84 then player0y = 84

 

rem Have player 1 chase player 2

if player1y < player0y then player1y = player1y + 1

if player1y > player0y then player1y = player1y - 1

if player1x < player0x then player1x = player1x + 1

if player1x > player0x then player1x = player1x - 1

player1x = player1x : player1y = player1y

 

 

rem Detect missile collision with squirrel

if collision(missile1,player1) then score=score+1:player1x=rand/2:player1y=0:missile1y=255:goto pointsound

rem Detect squirrel collision with the acorn

if collision(player0,player1) then score=score-1:player1x=rand/2:player1y=0:missile1y=255:a=a-1:goto deadsound

 

 

rem joystick movements

if joy0up then player0y = player0y-1 : goto skipmove

if joy0down then player0y = player0y+1 : goto skipmove

if joy0left then player0x = player0x-1 : goto skipmove

if joy0right then player0x = player0x +1 : goto skipmove

 

rem refresh the screen

skipmove

goto main

 

rem Play point sound

pointsound

AUDV0 = 5 : AUDC0 = 8 : AUDF0 = 10

p = p + 1

drawscreen

if p < 2 then pointsound

p = 0

AUDV0 = 0 : AUDC0 = 0 : AUDF0 = 0

goto main

 

rem Play dead sound

deadsound

AUDV1 = 8

AUDC1 = 6

AUDF1 = 12

p = p + 1

drawscreen

if p < 5 then deadsound

p = 0

AUDV1 = 0 : AUDC1 = 0 : AUDF1 = 0

if a = 0 then goto deadscreen

goto main

Link to comment
Share on other sites

I think it's because you have the title screen right after the deadscreen. So you're drawing the deadscreen first and then immediately drawing over it with the title screen. Maybe add a loop right after the dead screen to draw the screen and wait for input like you did for the title screen?

Link to comment
Share on other sites

here I've set a (lives) right at the beginning then choose
the deadscreen or the title based on that (you still
need to set it when you begin again after you've run
out of lives

(sorry I was messing with your code so I don't know
what I might have messed up)

it would be nice if you used the code tags and/or
attach your code

  rem Generated 1/4/2010 1:48:01 PM by Visual bB Version 1.0.0.548
  rem **********************************
  rem *<Tinkernut World> *
  rem *<Shoot the squirrel before he *
  rem *eats you.> *
  rem *<admin@tinkernut.com> *
  rem *<www.tinkernut.com> *
  rem **********************************

  rem Create a variable to keep up with lives
  a = 5

deadscreen

  if a then opening

  rem Create the dead screen

  playfield:
  .............XX.................
  ............XXXX................
  .............XX.................
  .........XXXXXXXXXX.............
  ........XX........XX............
  ........XXXXX.X..XXX............
  ........XX.X..X..XXX............
  ........XX.X...XX.XX............
  ........XX........XX............
  ........XX........XX............
  ........XX........XX............
end


  rem added a delay so deadscreen shows
  rem if your still firing
  a = 60
delay
  drawscreen
  a = a - 1
  if a then delay

  goto title


  rem Create the title screen
opening

  playfield:
  .XX.XXX.XX..XXX...XX..X.X.XXX.XX
  X....X.X....X..X.X..X.X.X.X..X..
  .X...X.X.XX.XXX..XXXX.X.X.XX..X.
  ..X..X.X..X.X.X..X..X.X.X.X....X
  XX...X..XX..X..X.X..X..X..XXX.XX
  ................................
  ....X...X.XXXX.XXX..X...XXX.....
  ....X...X.X..X.X..X.X...X..X....
  ....X...X.X..X.XX...X...X..X....
  ....X.X.X.X..X.X.X..X...X..X....
  ....XX.XX.XXXX.X..X.XXX.XXX.....
end

  COLUBK = $00
  COLUPF = $0E


  rem Loop the screen until the spacebar is pressed
title
  drawscreen
  if !joy0fire && !joy1fire then title

  rem This function displays after the title is skipped
skiptitle

  rem Colors
  COLUPF = $40
  COLUBK = $60
  COLUP0 = 222

  rem Player location
  player0x = 50 : player0y = 50
  player1x = 20 : player1y = 20

  rem Score setting and color
  score = 0 : scorecolor = $F8

  rem Missle size and location
  missile1height=6:missile1y=255
  NUSIZ0 = 25

  rem Create a variable to keep up with lives
  a = 5

  rem Create the playfield

  playfield:
  ..XX..XX..XX..XX..XX..XX..XX..XX
  XX..XX..XX..XX..XX..XX..XX..XX..
  ..XX..XX..XX..XX..XX..XX..XX..XX
  XX..XX..XX..XX..XX..XX..XX..XX..
  ..XX..XX..XX..XX..XX..XX..XX..XX
  XX..XX..XX..XX..XX..XX..XX..XX..
  ..XX..XX..XX..XX..XX..XX..XX..XX
  XX..XX..XX..XX..XX..XX..XX..XX..
  ..XX..XX..XX..XX..XX..XX..XX..XX
  XX..XX..XX..XX..XX..XX..XX..XX..
  ..XX..XX..XX..XX.XXX..XXX.XX..XX
end


  rem Create acorn sprite

  player0:
  %01111110
  %01000010
  %01011010
  %11000010
  %01100111
  %11111110
  %01010101
  %10010010
end


  rem This main function is what loops constantly
main

  rem This is the animation function
animate
  rem This frame variable slows down the animation
  v = v + 1
 
  rem This code animates the sprites
  if v > 7 then on w gosub ax bx cx dx : v = 0 : w = w + 1 : if w > 3 then w = 0


nextstep


  rem check to see if a missile has already been fired
checkfire
  if missile1y > 100 then goto skip
  missile1y = missile1y - 2 : goto draw

  rem if a missile hasn't been fired, then fire missile
skip
  if joy0fire then missile1y = player0y - 2 : missile1x = player0x + 4

  rem Draw output to screen
draw
  drawscreen

  rem Fix player wraparound bug
  if player0x < 8 then player0x = 8
  if player0x > 150 then player0x = 150
  if player0y < 8 then player0y = 8
  if player0y > 84 then player0y = 84

  rem Have player 1 chase player 2
  if player1y < player0y then player1y = player1y + 1
  if player1y > player0y then player1y = player1y - 1
  if player1x < player0x then player1x = player1x + 1
  if player1x > player0x then player1x = player1x - 1
  player1x = player1x : player1y = player1y


  rem Detect missile collision with squirrel
  if collision(missile1,player1) then score = score + 1 : player1x = rand / 2 : player1y = 0 : missile1y = 255 : goto pointsound
  rem Detect squirrel collision with the acorn
  if collision(player0,player1) then score = score - 1 : player1x = rand / 2 : player1y = 0 : missile1y = 255 : a = a - 1 : goto deadsound


  rem joystick movements
  if joy0up then player0y = player0y - 1
  if joy0down then player0y = player0y + 1
  if joy0left then player0x = player0x - 1
  if joy0right then player0x = player0x + 1

  rem refresh the screen
skipmove
  goto main

  rem These four sprites are different stages of the animation
ax

  player1:
  %00011000
  %01111110
  %01111110
  %01111110
  %00100100
  %11000011
  %01000010
  %11000011
end

  return


bx

  player1:
  %00011000
  %01111110
  %01111110
  %01111110
  %00100100
  %11000011
  %01000010
  %11000011
end

  return


cx

  player1:
  %00011000
  %01111110
  %01011010
  %01111110
  %00100100
  %11000011
  %01000010
  %11000011
end

  return


dx

  player1:
  %00011000
  %01111110
  %01011010
  %01111110
  %00100100
  %11000011
  %01000010
  %11000011
end

  return


  rem Play point sound
pointsound
  AUDV0 = 5 : AUDC0 = 8 : AUDF0 = 10
  p = p + 1
  drawscreen
  if p < 2 then pointsound
  p = 0
  AUDV0 = 0 : AUDC0 = 0 : AUDF0 = 0
  goto main

  rem Play dead sound
deadsound

  AUDV1 = 8
  AUDC1 = 6
  AUDF1 = 12
  p = p + 1
  drawscreen
  if p < 5 then deadsound
  p = 0
  AUDV1 = 0 : AUDC1 = 0 : AUDF1 = 0
  if a = 0 then goto deadscreen
  goto main

edit: added a delay so that the deadscreen shows

if you're still firing





Edited by bogax
  • Like 1
Link to comment
Share on other sites

Thanks i finally got it to work, it was a matter of making a loop for the screen and to change it from firing to pressing up.

Glad to hear you got it working.

 

If you're having problems with the deathscreen being skipped in situations where the player is pressing up when they die, you may need to make the loop ignore the controller input for 30 frames or so to give the player some time to release the joystick/button before proceeding. Another option is to add logic that requires the up button be released and then pressed before proceeding. I hope that makes sense, it's difficult to explain.

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