mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-11-22 06:31:48 +00:00
Basic camera shot tracking working
This commit is contained in:
parent
7ba22eadda
commit
bfec5c2234
@ -36,7 +36,7 @@ beginGameplay:
|
|||||||
ldy #0
|
ldy #0
|
||||||
jsr playerCreate
|
jsr playerCreate
|
||||||
|
|
||||||
lda #196
|
lda #600
|
||||||
ldy #1
|
ldy #1
|
||||||
jsr playerCreate
|
jsr playerCreate
|
||||||
|
|
||||||
@ -59,8 +59,8 @@ gameplayLoop:
|
|||||||
jsr renderPlayers
|
jsr renderPlayers
|
||||||
|
|
||||||
gameplayLoopKbd:
|
gameplayLoopKbd:
|
||||||
; lda projectileActive
|
lda projectileActive
|
||||||
; bpl gameplayLoopProjectiles ; Skip input during shots
|
bpl gameplayLoopShotTracking ; Skip input during shots
|
||||||
|
|
||||||
; Check for keys down
|
; Check for keys down
|
||||||
jsr kbdScan
|
jsr kbdScan
|
||||||
@ -69,6 +69,8 @@ gameplayLoopKbd:
|
|||||||
lda paused
|
lda paused
|
||||||
bne gameplayLoopEndFrame
|
bne gameplayLoopEndFrame
|
||||||
|
|
||||||
|
gameplayLoopScroll:
|
||||||
|
|
||||||
; Scroll map if needed
|
; Scroll map if needed
|
||||||
lda mapScrollRequested
|
lda mapScrollRequested
|
||||||
bmi gameplayLoopAngle
|
bmi gameplayLoopAngle
|
||||||
@ -112,6 +114,64 @@ gameplayLoopEndFrame:
|
|||||||
beq gameplayLoop
|
beq gameplayLoop
|
||||||
jmp quitGame
|
jmp quitGame
|
||||||
|
|
||||||
|
gameplayLoopShotTracking:
|
||||||
|
jsr trackActiveShot
|
||||||
|
bra gameplayLoopScroll
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; trackActiveShot
|
||||||
|
;
|
||||||
|
; Handles tracking the projectile with the camera
|
||||||
|
;
|
||||||
|
; Trashes SCRATCHL
|
||||||
|
;
|
||||||
|
trackActiveShot:
|
||||||
|
lda projectileData+JD_PRECISEX
|
||||||
|
lsr ; Convert to integer and divide by two for byte distance
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
sta SCRATCHL ; Save this for later
|
||||||
|
|
||||||
|
lda projectileData+JD_VX
|
||||||
|
bmi trackActiveShotNeg
|
||||||
|
|
||||||
|
; Left-to-right
|
||||||
|
lda mapScrollPos
|
||||||
|
cmp #VISIBLETERRAINWIDTH-VISIBLETERRAINWINDOW
|
||||||
|
beq trackActiveShotDone ; Logical-right edge clamp
|
||||||
|
|
||||||
|
lda SCRATCHL
|
||||||
|
sec
|
||||||
|
sbc #80 ; Check for moving past center
|
||||||
|
cmp leftScreenEdge
|
||||||
|
bpl trackActiveShotCameraMove
|
||||||
|
bra trackActiveShotDone
|
||||||
|
|
||||||
|
trackActiveShotNeg:
|
||||||
|
|
||||||
|
; Right-to-left
|
||||||
|
lda mapScrollPos
|
||||||
|
beq trackActiveShotDone ; Logical-left edge clamp
|
||||||
|
|
||||||
|
lda SCRATCHL
|
||||||
|
clc
|
||||||
|
adc #80 ; Check for moving past center
|
||||||
|
cmp rightScreenEdge
|
||||||
|
bpl trackActiveShotDone
|
||||||
|
|
||||||
|
trackActiveShotCameraMove:
|
||||||
|
lda SCRATCHL
|
||||||
|
sbc #80
|
||||||
|
lsr
|
||||||
|
and #$fffe ; Force even
|
||||||
|
sta mapScrollRequested
|
||||||
|
|
||||||
|
trackActiveShotDone:
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; endTurn
|
; endTurn
|
||||||
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
10
player.s
10
player.s
@ -15,9 +15,9 @@ playerData:
|
|||||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||||
|
|
||||||
.word 45 ; Angle in degrees from +X
|
.word 25 ; Angle in degrees from +X
|
||||||
.word 1 ; Power
|
.word 2 ; Power
|
||||||
.word 100 ; Anger
|
.word 100 ; Anger
|
||||||
.byte 8,"SPROCKET " ; Name
|
.byte 8,"SPROCKET " ; Name
|
||||||
|
|
||||||
.repeat 108
|
.repeat 108
|
||||||
@ -32,8 +32,8 @@ playerData:
|
|||||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||||
|
|
||||||
.word 135 ; Angle in degrees from +X
|
.word 155 ; Angle in degrees from +X
|
||||||
.word 1 ; Power
|
.word 2 ; Power
|
||||||
.word 100 ; Anger
|
.word 100 ; Anger
|
||||||
.byte 8,"TINKER " ; Name
|
.byte 8,"TINKER " ; Name
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user