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
|
||||
jsr playerCreate
|
||||
|
||||
lda #196
|
||||
lda #600
|
||||
ldy #1
|
||||
jsr playerCreate
|
||||
|
||||
@ -59,8 +59,8 @@ gameplayLoop:
|
||||
jsr renderPlayers
|
||||
|
||||
gameplayLoopKbd:
|
||||
; lda projectileActive
|
||||
; bpl gameplayLoopProjectiles ; Skip input during shots
|
||||
lda projectileActive
|
||||
bpl gameplayLoopShotTracking ; Skip input during shots
|
||||
|
||||
; Check for keys down
|
||||
jsr kbdScan
|
||||
@ -69,6 +69,8 @@ gameplayLoopKbd:
|
||||
lda paused
|
||||
bne gameplayLoopEndFrame
|
||||
|
||||
gameplayLoopScroll:
|
||||
|
||||
; Scroll map if needed
|
||||
lda mapScrollRequested
|
||||
bmi gameplayLoopAngle
|
||||
@ -112,6 +114,64 @@ gameplayLoopEndFrame:
|
||||
beq gameplayLoop
|
||||
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
|
||||
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
8
player.s
8
player.s
@ -15,8 +15,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 45 ; Angle in degrees from +X
|
||||
.word 1 ; Power
|
||||
.word 25 ; Angle in degrees from +X
|
||||
.word 2 ; Power
|
||||
.word 100 ; Anger
|
||||
.byte 8,"SPROCKET " ; Name
|
||||
|
||||
@ -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 135 ; Angle in degrees from +X
|
||||
.word 1 ; Power
|
||||
.word 155 ; Angle in degrees from +X
|
||||
.word 2 ; Power
|
||||
.word 100 ; Anger
|
||||
.byte 8,"TINKER " ; Name
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user