mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-11-25 10:30:49 +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.
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 45 ; Angle in degrees from +X
|
||||
.word 1 ; Power
|
||||
.word 100 ; Anger
|
||||
.word 25 ; Angle in degrees from +X
|
||||
.word 2 ; Power
|
||||
.word 100 ; Anger
|
||||
.byte 8,"SPROCKET " ; Name
|
||||
|
||||
.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 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