Jump to content
IGNORED

Pfscore health help and Game over screen


Matth89812

Recommended Posts

man I'm no expert

 

but I think your problem is that the sprites routine keeps

reseting pfscore1

 

set pfscore1 to %11111111 before (or at least outside)

the sprites routine (forget the pfscore1 = 100)

 

then instead of pfscore1 = pfscore1 - 25 make it

pfscore1 = pfscore1 * 4

Link to comment
Share on other sites

Also the health bar pfscore1 and pfscore2 are really a graphic representation of your health and they don't display correctly unless the value is exactly 255, 127, 63, 31, 15,7,3,1 and 0. You will need to convert your damage value to scale to the pfscore_ value.

 

This is how I originally did it. Bogax showed me a better way. But this way is hopefully clear.

If my player0 touched player 1 or missile on it would take 3 damage. Depending on the damage level pfscore2 would display accordingly. Once the damage level became lethal, then it would jump to the death routine.

 

if collision(player0,player1) && !p=6:then r=r+3
if collision(player0,missile1) && !p=6:then r=r+3
if r=0 then pfscore2 = %11111111
if r>30 then pfscore2 = %01111111
if r>60 then pfscore2 = %00111111
if r>90 then pfscore2 = %00011111
if r>120 then pfscore2 = %00001111
if r>150 then pfscore2 = %00000111
if r>180 then pfscore2 = %00000011
if r>210 then pfscore2 = %00000001
if r>240 then pfscore2 = %00000000
if r>242 then goto __gizdead bank4
The more efficient way Bogax showed me looks like this:
if collision(player0,player1) && !p=6:then r=r+3
if collision(player0,missile1) && !p=6:then r=r+3
if r > 0 && r < 31 then __skip
rem temp1 = r / 30
temp1 = r / 2 : temp1 = ((temp1 / 16) + 1 + temp1) / 16
pfscore2 = tbl[temp1]
data tbl
%11111111, %01111111, %00111111, %00011111, %00001111, %00000011, %00000001, %00000000
end
if r > 242 then goto __gizdead bank4
__skip
Link to comment
Share on other sites

 

  if collision(missile0, player1) then score = score + 1 : player1x = rand/2 : player1y = 0 : missile0y = 255
  if collision(player0 , player1) then score = score - 1 : player1x = rand/2 : player1y = 0 : missile0y = 255 : pfscore1 = pfscore1*4

  rem pfscore1 may have changed so check to see if you've
  rem run out of lives and if so jump to game over
  rem !pfscore1 is like pfscore1 = 0

  if !pfscore1 then gameover


  goto __Main_Loop


jump
  goto sprites
  goto draw_loop

gameover

  playfield:
 ..XXXXXX..XXXXX..XXXXXXX..XXXXXX
 ..X.......X...X..X..X..X..X.....
 ..X.XXX...XXXXX..X..X..X..XXXXXX
 ..X...X...X...X..X..X..X..X.....
 ..XXXXX...X...X..X.....X..XXXXXX
 ................................
 ..XXXXXX.X........X.XXXX..XXXX..
 ..X....X..X......X..X.....X..X..
 ..X....X...X....X...XXXX..XXXX..
 ..X....X....X..X....X.....XX....
 ..XXXXXX.....XX.....XXXX..X.X...
end

gameover_loop
 drawscreen
 goto gameover_loop

 

something like that then

 

although I assume you're going to want some way

to break out of the gameover_loop

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