Jump to content
IGNORED

Help with Pfscroll


STGraves

Recommended Posts

Hello I have 3 different playfields in my game one is the main screen, second is the main playdçfield, and the third is the deadscreen, i can make the playfield to scroll, but when I die and reset the game, the title screen and the deadscreen appear to be moved out of their orientation, i think is because the pfscroll moves the 3 of the PF's, how can i keep the title screen and dead screen fixed in place while the main PF moves with pfscroll?.

Thanks.

 rem **********************************
 rem *<STGraves world>*
 rem *<Mata a cuernotrayamon*
 rem *antes que el a ti.> *
 rem *<agpkkck@gmail.com>*
 rem *<www.stgravesof.zz.vc>*
 rem **********************************

 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 fire button is pressed
title
 COLUBK = $D4
 COLUPF = $80
 drawscreen
 if joy0fire || joy1fire then goto skiptitle
 scorecolor = $D4
 goto title

 rem This function displays after the title is skipped
skiptitle

 rem Colors
 COLUPF = $D6
 COLUBK = $FE

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

 rem Score setting and color
 score = 0 : scorecolor = $40
 rem Missle size and location
 missile1height=6:missile1y=255
 rem Create a variable to keep up with lives
 
 a = 5

 rem create lives
   lives:
   %01000100
   %11111110
   %11111110
   %01111100
   %00111000
   %00010000
   %00010000
   %00010000
end


 rem Create the playfield

 playfield:
 XXXXXXXXXXXXXXX...............
 XXXXXXXXXXXXXXX...............
 XXXXXXXXXXXXXXX...............
 XXXXXXXXXXXXXXX...............
 XXXXXXXXXXXXXXX...............
 ...............XXXXXXXXXXXXXXX
 ...............XXXXXXXXXXXXXXX
 ...............XXXXXXXXXXXXXXX
 ...............XXXXXXXXXXXXXXX
 ...............XXXXXXXXXXXXXXX
 XXXXXXXXXXXXXXX...............
 XXXXXXXXXXXXXXX...............
end


 rem This main function is what loops constantly
main
   if joy0up || joy1up then pfscroll down
   if joy0down || joy1down then pfscroll up
   if joy0left || joy1left then pfscroll right
   if joy0right || joy1right then pfscroll left
end if
 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: player1:
 %00100100
 %01111110
 %01111110
 %01111110
 %00100100
 %11000011
 %01000010
 %11000011
end


 goto nextstep
 
bx
 v = 0
 w = 2

 player1:
 %00100100
 %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
 %01000011
 %11011010
 %01000011
 %11100110
 %01111110
 %10101011
 %01101001
end


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 || joy1fire 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 || joy1up then player0y = player0y-1 : goto skipmove
 if joy0down || joy1down then player0y = player0y+1 : goto skipmove
 if joy0left || joy1left then player0x = player0x-1 : goto skipmove
 if joy0right || joy1right then player0x = player0x +1 : goto skipmove

 rem refresh the screen
skipmove
 goto main

 rem Play point sound
pointsound
 AUDV0 = 8 : AUDC0 = 12 : 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 = 7
 AUDF1 = 13
 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

 rem Create the dead screen
deadscreen


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




 rem Loop the screen until the reset switch is activated
dead
 COLUBK = $F4
 COLUPF = $60
 scorecolor = $F4
 drawscreen
 if switchreset then goto opening
drawscreen
 goto dead
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...