Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set kernel multisprite
- set optimization noinlinedata
- dim tx = temp1
- dim ty = temp2
- dim pptr = temp4
- dim dir = temp5
- dim cf = temp6
- dim sc0 = score
- dim sc1 = score + 1
- dim sc2 = score + 2
- dim dx = a
- dim dy = b
- dim jf = c
- dim sf = d
- dim pno = e
- const pxb = player0x
- const pyb = player0y
- pfheight = 7
- mk1
- playfield:
- ................
- ................
- ................
- ..............XX
- ..............XX
- ..............XX
- ..............XX
- ................
- ................
- ................
- ................
- end
- player0:
- %00010000
- %01000010
- %00000000
- %10000001
- %00000000
- %01000010
- %00010000
- %10000000
- end
- rem 0 0 upper left
- rem table order left middle = 0
- rem increasing counter clockwise
- rem -16 x offset -10 y offset
- rem 0, 1, 3, 6, 7, 6, 3, 1
- rem -16, -15, -13, -10, -9, -10, -13, -15
- rem 3, 5, 6, 5, 3, 1, 0, 1
- rem -7, -5, -4, -5, -7, -9, -10, -9
- player1:
- %00000000
- %00000000
- %00000000
- %00000000
- %00011111
- %00001110
- %00001110
- %10000100
- end
- rem 0 0 upper left
- rem table order left middle = 0
- rem increasing counter clockwise
- rem -24 x offset -8 y offset
- rem 3, 4, 5, 6, 7, 6, 5, 4
- rem -21, -20, -19, -18, -17, -18, -19, -20
- rem 4, 6, 7, 6, 4, 4, 4, 4
- rem -4, -2, -1, -2, -4, -4, -4, -4
- player2:
- %00011100
- %00000000
- %00110001
- %00000001
- %10000001
- %10000001
- %00000000
- %00011000
- end
- rem 0, 0, 4, 7, 7, 5, 3, 2
- rem -24, -24, -20, -17, -17, -19, -21, -22
- rem 4, 5, 7, 5, 2, 0, 0, 2
- rem -4, -3, -1, -3, -6, -8, -8, -6
- player3:
- %00010000
- %00010000
- %01111000
- %00011111
- %11111000
- %00111110
- %00001000
- %00001000
- end
- rem 0, 2, 4, 6, 7, 4, 3, 1
- rem -24, -22, -20, -18, -17, -20, -21, -23
- rem 4, 5, 7, 5, 3, 2, 0, 2
- rem -4, -3, -1, -3, -5, -6, -8, -6
- player4:
- %00010000
- %00010000
- %00010000
- %01111110
- %00001000
- %00001000
- %00001000
- %00000000
- end
- rem 1, 4, 4, 4, 6, 3, 3, 3
- rem -23, -20, -20, -20, -18, -21, -21, -21
- rem 3, 3, 6, 3, 3, 3, 0, 3
- rem -5, -5, -2, -5, -5, -5, -8, -5
- player5:
- %00000000
- %00010000
- %00011100
- %00110000
- %10000001
- %10010111
- %00010100
- %00011100
- end
- rem 0, 3, 3, 7, 7, 5, 3, 0
- rem -24, -21, -21, -17, -17, -19, -21, -24
- rem 5, 5, 7, 7, 4, 2, 1, 3
- rem -3, -3, -1, -1, -4, -6, -7, -5
- pno = 0 : cf = $FF : jf = $80
- COLUPF = $92
- COLUBK = $9C
- COLUP2 = $56
- COLUP3 = $46
- COLUP4 = $36
- COLUP5 = $26
- player0x = $16 : player1x = $16 : player2x = $16
- player3x = $16 : player4x = $16 : player5x = $16
- player0y = $0C : player1y = $18 : player2y = $24
- player3y = $30 : player4y = $3C : player5y = $48
- main
- temp2 = ((jf ^ $80) & INPT4) & $80 : jf = INPT4
- if temp2 then pno = pno_tbl[pno]
- temp2 = ((SWCHA ^ $FF) & sf)/16 : sf = SWCHA
- temp2 = (sf/16) ^ $0F
- dir = dir_tbl[temp2]
- if !temp2 then no_move
- gosub move_player
- no_move
- COLUP0 = $1C
- COLUP1 = $66
- drawscreen
- goto main
- move_player
- gosub test
- if !cf then move
- rem if not odd-diagonal then done
- rem else check x, y individually
- if !dir{0} then move_done
- dir = (dir - 1) & 7
- gosub test
- if !cf then move
- dir = (dir + 2) & 7
- gosub test
- if cf then move_done
- move
- rem adjust player position according to direction
- pxb[pno] = pxb[pno] + dx_tbl[dir]
- pyb[pno] = pyb[pno] + dy_tbl[dir]
- temp1 = pxb[pno] : temp2 = pyb[pno]
- gosub update_scr
- move_done
- return
- test
- dx = dx_tbl[dir] + pxb[pno] : dy = dy_tbl[dir] + pyb[pno]
- pptr = pno_mul_tbl[pno] + dir : cf = $FF
- tx = (px_tbl[pptr] + dx)/4 : ty = (py_tbl[pptr] + dy)/8
- if !pfread(tx, ty) then return
- pptr = pptr + 1
- tx = (px_tbl[pptr] + dx)/4 : ty = (py_tbl[pptr] + dy)/8
- if !pfread(tx, ty) then test_done
- pptr = pptr + 1
- tx = (px_tbl[pptr] + dx)/4 : ty = (py_tbl[pptr] + dy)/8
- if !pfread(tx, ty) then test_done
- pptr = pptr + 1
- tx = (px_tbl[pptr] + dx)/4 : ty = (py_tbl[pptr] + dy)/8
- if !pfread(tx, ty) then test_done
- pptr = pptr + 1
- tx = (px_tbl[pptr] + dx)/4 : ty = (py_tbl[pptr] + dy)/8
- if !pfread(tx, ty) then test_done
- cf = cf + 1
- test_done
- return
- data px_tbl
- -16, -15, -13, -10, -9, -10, -13, -15, -16, -15, -13, -10
- -21, -20, -19, -18, -17, -18, -19, -20, -21, -20, -19, -18
- -24, -24, -20, -17, -17, -19, -21, -22, -24, -24, -20, -17
- -24, -22, -20, -18, -17, -20, -21, -23, -24, -22, -20, -18
- -23, -20, -20, -20, -18, -21, -21, -21, -23, -20, -20, -20
- -24, -21, -21, -17, -17, -19, -21, -24, -24, -21, -21, -17
- end
- data py_tbl
- -7, -5, -4, -5, -7, -9, -10, -9, -7, -5, -4, -5
- -4, -2, -1, -2, -4, -4, -4, -4, -4, -2, -1, -2
- -4, -3, -1, -3, -6, -8, -8, -6, -4, -3, -1, -3
- -4, -3, -1, -3, -5, -6, -8, -6, -4, -3, -1, -3
- -5, -5, -2, -5, -5, -5, -8, -5, -5, -5, -2, -5
- -3, -3, -1, -1, -4, -6, -7, -5, -3, -3, -1, -1
- end
- data dx_tbl
- 0, 1, 1, 1, 0, -1, -1, -1
- end
- data dy_tbl
- 1, 1, 0, -1, -1, -1, 0, 1
- end
- data dir_tbl
- 0, 0, 4, 0, 6, 7, 5, 0, 2, 1, 3
- end
- data pno_tbl
- 1, 2, 3, 4, 5, 0
- end
- data pno_mul_tbl
- 0, 12, 24, 36, 48, 60
- end
- update_scr
- sc0 = 0 : sc1 = sc1 & 15
- if temp1 >= 100 then sc0 = sc0 + 16 : temp1 = temp1 - 100
- if temp1 >= 100 then sc0 = sc0 + 16 : temp1 = temp1 - 100
- if temp1 >= 50 then sc0 = sc0 + 5 : temp1 = temp1 - 50
- if temp1 >= 30 then sc0 = sc0 + 3 : temp1 = temp1 - 30
- if temp1 >= 20 then sc0 = sc0 + 2 : temp1 = temp1 - 20
- if temp1 >= 10 then sc0 = sc0 + 1 : temp1 = temp1 - 10
- sc1 = (temp1 * 4 * 4) | sc1
- sc1 = sc1 & 240 : sc2 = 0
- if temp2 >= 100 then sc1 = sc1 + 1 : temp2 = temp2 - 100
- if temp2 >= 100 then sc1 = sc1 + 1 : temp2 = temp2 - 100
- if temp2 >= 50 then sc2 = sc2 + 80 : temp2 = temp2 - 50
- if temp2 >= 30 then sc2 = sc2 + 48 : temp2 = temp2 - 30
- if temp2 >= 20 then sc2 = sc2 + 32 : temp2 = temp2 - 20
- if temp2 >= 10 then sc2 = sc2 + 16 : temp2 = temp2 - 10
- sc2 = sc2 | temp2
- return
- asm
- pfread
- clc
- adc #$08
- and #$1F
- cmp #$10
- and #$0F
- tax
- lda bit_masks,x
- bcc skip_PF2_and
- and (PF2pointer),y
- bcs skip_PF1_and
- skip_PF2_and
- and (PF1pointer),y
- skip_PF1_and
- return
- bit_masks
- .byte $01, $02, $04, $08, $10, $20, $40, $80
- .byte $80, $40, $20, $10, $08, $04, $02, $01
- end
- mk2
- asm
- echo (.mk2 - .mk1)d
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement