Jump to content
IGNORED

Strange glitch with sprites


Retro Lord

Recommended Posts

I have painted myself into a corner here and I could use an idea on how to solve my current mess up.

 

player0 is a skiier and player1 is trees and rocks scrolling upwards if g =0. If g=1 then player1 is a yeti scrolling down. So far so good.

The mess up is when the yeti reaches the bottom of the screen the game should go back to picking trees or rocks but it decides to do yeti's instead. Any thoughts?

  rem CODE INSPIRED BY Atarius Maximus at http://www.atariage.com/forums/index.php?showtopic=109288

  player0x = 50
  player0y = 50

 dim _P1_L_R = player1x.d
 dim _P1_U_D = player1y.e

 player1x=60 : player1y=80

main

  rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME...
  if a = 0 then player0:
        %01000100
        %01000100
        %00000000
        %01000100
        %01000100
        %01101100
        %00111000
        %01111100
        %01111100
        %00111000
        %00010000
        %00101000
        %00010000
        %00111000
        %00111000
        %00010000
end

  if a = 1 then player0:
        %00010001
        %00100010
        %01000100
        %10101010
        %00100010
        %00100100
        %00111000
        %01010100
        %01111100
        %10111000
        %00010000
        %01101000
        %01010000
        %01111000
        %00111000
        %01110000
end
 rem death
  if a = 2 then player0:
        %00000000
        %00000000
        %00000000
        %00010000
        %00100000
        %01000000
        %10000100
        %00000100
        %00000010
        %00000010
        %00000000
        %00000000
        %00000000
        %01110000
        %01110100
        %00111000
end

 if f=0 then player1:
        %00000000
        %00000000
        %00111000
        %00111000
        %00111000
        %00111000
        %00000000
        %01111100
        %11000110
        %10111010
        %01101100
        %01010100
        %00111000
        %00101000
        %00010000
        %00010000
end

 if f=1 then player1:
        %00000000
        %00000000
        %00000000
        %00000000
        %00000000
        %00000000
        %00000100
        %00001110
        %00111110
        %01111110
        %00111100
        %00000000
        %00000000
        %00000000
        %00000000
        %00000000
end

  if f = 3 && g=1 then player1:
        %00100000
        %00101000
        %01000100
        %01000100
        %00111000
        %01110100
        %01101101
        %01011110
        %00111100
        %00000000
        %01111100
        %10101000
        %11010100
        %11111100
        %11010100
        %01111000
end

  if f = 4 && g=1 then player1:
        %00000000
        %11000010
        %00100010
        %01000110
        %00111000
        %01110100
        %01101101
        %01011110
        %00111100
        %01111100
        %10101000
        %10000000
        %11010100
        %11111100
        %11010100
        %01111000
end



 if g=1 then f=f+1

 if f=4 then f=3

 if f=0 then COLUP1=$D6
 if f=1 then COLUP1=$06

 h=h+1

  if joy0right then REFP0 = 0
  if joy0left then REFP0 = 8

 if b=1 then REFP0=0 : player1x = player1x - 1
 if b=2 then REFP0=8 : player1x = player1x + 1

 COLUP0=$44
 COLUBK=$0E
  drawscreen

 if c=0 then NUSIZ1=$00
 if c=1 then NUSIZ1=$01
 if c=2 then NUSIZ1=$02
 if c=3 then NUSIZ1=$03
 if c=4 then NUSIZ1=$04
 if c=5 then NUSIZ1=$05
 if c=6 then NUSIZ1=$06
 if c=7 then NUSIZ1=$07


 if h=100 then i=1
 if i<2 then player1y=player1y-1
 if i=2 then player1y=player1y+2

 if i=2 && player1y>90 then h=0 : i=0 : c=(rand&7) : player1x=rand : f=(rand&1)

  if joy0right then b=1 : a=1 : player1x = player1x - 1
  if joy0left then b=2 : a=1 : player1x = player1x + 1
  if joy0up then a=0 : _P1_U_D = _P1_U_D + 0.25 : b=0
  if joy0down then a=0 : _P1_U_D = _P1_U_D - 0.25 : b=0

 if player1y<10 && i=0 then player1y=90 : c=(rand&7) : player1x=rand : f=(rand&1)
 if player1y<10 && i=1 then player1y=11 : player1x=rand : f=3 : g=1 : i=2


 if player1x<10 then player1x=135
 if player1x>135 then player1x=10
  goto main

Link to comment
Share on other sites

Sorry about that. I must remember too comment things.

 

Does this clarify things more?

  rem CODE INSPIRED BY Atarius Maximus at http://www.atariage.com/forums/index.php?showtopic=109288

  player0x = 50
  player0y = 50

 dim _P1_L_R = player1x.d
 dim _P1_U_D = player1y.e

 player1x=60 : player1y=80

main

  rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME...
  if a = 0 then player0:
        %01000100
        %01000100
        %00000000
        %01000100
        %01000100
        %01101100
        %00111000
        %01111100
        %01111100
        %00111000
        %00010000
        %00101000
        %00010000
        %00111000
        %00111000
        %00010000
end

  if a = 1 then player0:
        %00010001
        %00100010
        %01000100
        %10101010
        %00100010
        %00100100
        %00111000
        %01010100
        %01111100
        %10111000
        %00010000
        %01101000
        %01010000
        %01111000
        %00111000
        %01110000
end
 rem death
  if a = 2 then player0:
        %00000000
        %00000000
        %00000000
        %00010000
        %00100000
        %01000000
        %10000100
        %00000100
        %00000010
        %00000010
        %00000000
        %00000000
        %00000000
        %01110000
        %01110100
        %00111000
end
 rem tree
 if f=0 then player1:
        %00000000
        %00000000
        %00111000
        %00111000
        %00111000
        %00111000
        %00000000
        %01111100
        %11000110
        %10111010
        %01101100
        %01010100
        %00111000
        %00101000
        %00010000
        %00010000
end
 rem rock
 if f=1 then player1:
        %00000000
        %00000000
        %00000000
        %00000000
        %00000000
        %00000000
        %00000100
        %00001110
        %00111110
        %01111110
        %00111100
        %00000000
        %00000000
        %00000000
        %00000000
        %00000000
end
 rem yeti
  if f = 3 && g=1 then player1:
        %00100000
        %00101000
        %01000100
        %01000100
        %00111000
        %01110100
        %01101101
        %01011110
        %00111100
        %00000000
        %01111100
        %10101000
        %11010100
        %11111100
        %11010100
        %01111000
end
rem yeti
  if f = 4 && g=1 then player1:
        %00000000
        %11000010
        %00100010
        %01000110
        %00111000
        %01110100
        %01101101
        %01011110
        %00111100
        %01111100
        %10101000
        %10000000
        %11010100
        %11111100
        %11010100
        %01111000
end


rem if g=1 then player1 turns into yeti
 if g=1 then f=f+1

 if f=4 then f=3

 rem changes color depending on which sprite is shown
 if f=0 then COLUP1=$D6
 if f=1 then COLUP1=$06

 rem yeti counter
 h=h+1

  if joy0right then REFP0 = 0
  if joy0left then REFP0 = 8

 if b=1 then REFP0=0 : player1x = player1x - 1
 if b=2 then REFP0=8 : player1x = player1x + 1

 COLUP0=$44
 COLUBK=$0E
  drawscreen

 rem changes size and number of objects
 if c=0 then NUSIZ1=$00
 if c=1 then NUSIZ1=$01
 if c=2 then NUSIZ1=$02
 if c=3 then NUSIZ1=$03
 if c=4 then NUSIZ1=$04
 if c=5 then NUSIZ1=$05
 if c=6 then NUSIZ1=$06
 if c=7 then NUSIZ1=$07

 rem if  i < 2 then player1 is trees and rocks moving up
 rem if i=2 then player1 is yeti moving down
 if h=100 then i=1
 if i<2 then player1y=player1y-1
 if i=2 then player1y=player1y+2

 if i=2 && player1y>90 then h=0 : i=0 : c=(rand&7) : player1x=rand : f=(rand&1)

  if joy0right then b=1 : a=1 : player1x = player1x - 1
  if joy0left then b=2 : a=1 : player1x = player1x + 1
  if joy0up then a=0 : _P1_U_D = _P1_U_D + 0.25 : b=0
  if joy0down then a=0 : _P1_U_D = _P1_U_D - 0.25 : b=0

 if player1y<10 && i=0 then player1y=90 : c=(rand&7) : player1x=rand : f=(rand&1)
 if player1y<10 && i=1 then player1y=11 : player1x=rand : f=3 : g=1 : i=2


 if player1x<10 then player1x=135
 if player1x>135 then player1x=10
  goto main

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