Jump to content
IGNORED

Why does the movement/ collision prevention not work?


Recommended Posts

 rem ************************************************************************
     rem A project by Viggo Waller 
     rem ************************************************************************

     set kernel_options no_blank_lines
     set tv pal
     set romsize 16k
     set optimization speed
     set optimization size
     set smartbranching on
     set optimization noinlinedata
     set optimization inlinerand

     playfield:
     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     X..............................X
     X...XXXXX.XXX.XXXXX.X....XXXX..X
     X.....X....X....X...X....X.....X
     X.....X....X....X...X....X.....X
     X.....X....X....X...X....XXX...X
     X.....X....X....X...X....X.....X
     X.....X....X....X...X....X.....X
     X.....X...XXX...X...XXXX.XXXX..X
     X..............................X
     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end

title
     COLUBK = $00
     COLUPF = $0E
     drawscreen
     if joy0fire || joy1fire then goto skiptitle
     goto title
skiptitle

     playfield:
     XXXXX....XXXXXXXXXXXXXXXXXXXXXXX
     X..............................X
     X..............................X
     X...............................
     X...............................
     ................................
     ................................
     ...............................X
     X..............................X
     X..............................X
     XXXX....XXXXXXXXXXXXXXXXXXXXXXXX
end


     COLUBK = $00

     missile0height = 4  : missile0y = 255
     NUSIZ0 = $00
     score = 00000 :  scorecolor = $0E


     const _P_Edge_Top = 7
     const _P_Edge_Bottom = 88 
     const _P_Edge_Left = 13
     const _P_Edge_Right = 137


     
     AUDV0 = 0 : AUDV1 = 0 
    
     COLUP1 = $0E
     COLUP0 = $0E
     COLUPF = $0E

     player0:
     %0110
     %0110
     %1111
     %1010
     %1111
     %1001
end

     player0x = 77 : player0y = 53

__main

     if !joy0up then goto __Skip_Joy0_Up    
     if player0y <= _P_Edge_Top then goto __Skip_Joy0_Up    
     temp5 = (player0x-10)/4    
     temp6 = (player0y-7)/8    
     if temp5 < 34 then if pfread(temp5,temp6) then goto __Skip_Joy0_Up    
     temp4 = (player0x-17)/4    
     if temp4 < 34 then if pfread(temp4,temp6) then goto __Skip_Joy0_Up    
     temp3 = temp5 - 1    
     if temp3 < 34 then if pfread(temp3,temp6) then goto __Skip_Joy0_Up    
     player0y = player0y - 1    
__Skip_Joy0_Up

 

     if !joy0down then goto __Skip_Joy0_Down
     temp5 = (player0x-10)/4
     temp6 = (player0y+1)/8
     if temp5 < 34 then if pfread(temp5,temp6) then goto __Skip_Joy0_Down
     temp4 = (player0x-17)/4
     if temp4 < 34 then if pfread(temp4,temp6) then goto __Skip_Joy0_Down
     temp3 = temp5 - 1
     if temp3 < 34 then if pfread(temp3,temp6) then goto __Skip_Joy0_Down
     player0y = player0y + 1
__Skip_Joy0_Down


     if !joy0left then goto __Skip_Joy0_Left    
     temp5 = (player0y-1)/8
     temp6 = (player0x-15)/4          
     if temp6 < 34 then if pfread(temp6,temp5) then goto __Skip_Joy0_Left
     temp3 = (player0y-6)/8    
     if temp6 < 34 then if pfread(temp6,temp3) then goto __Skip_Joy0_Left
     player0x = player0x - 1        
__Skip_Joy0_Left 

     if !joy0right then goto __Skip_Joy0_Right
     temp5 = (player0y-1)/8
     temp6 = (player0x-9)/4
     if temp6 < 34 then if pfread(temp6,temp5) then goto __Skip_Joy0_Right
     temp3 = (player0y-6)/8
     if temp6 < 34 then if pfread(temp6,temp3) then goto __Skip_Joy0_Right
     player0x = player0x + 1 
__Skip_Joy0_Right

     if joy0left then a = a - 1
     if joy0right then a = a + 1 


     if joy0left || joy0right then goto __skip_y_anim 

     if joy0up then b = b + 1
     if joy0down then b = b - 1

     if  b  = 0 then player0:
     %1001
     %0110
     %1111
     %0101
     %1111
     %1001
end

     if b = 5 then player0:
     %0110
     %0110
     %1111
     %0101
     %1111
     %1001
end


     if b = 15 then player0:
     %0110
     %0110
     %1111
     %1010
     %1111
     %1001
end

     if b = 20 then player0:
     %1001
     %0110
     %1111
     %1010
     %1111
     %1001
end 


__skip_y_anim

     if  a  = 0 then player0:
     %1001
     %0110
     %1111
     %0101
     %1111
     %1001
end


     if a = 5 then player0:
     %0110
     %0110
     %1111
     %0101
     %1111
     %1001
end

     if a = 15 then player0:
     %0110
     %0110
     %1111
     %1010
     %1111
     %1001
end

     if a = 20 then player0:
     %1001
     %0110
     %1111
     %1010
     %1111
     %1001
end

     if a = 0 then a = 10
     if a = 20 then a = 10

     if b = 0 then b = 10
     if b = 20 then b = 10


     drawscreen

__skipmove
     goto __main

 

Edited by Cubwyn2600
Clarification
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...