mirror of
https://github.com/blondie7575/GSCats.git
synced 2025-02-16 09:31:47 +00:00
Basic projectile updating
This commit is contained in:
parent
bfc3144c89
commit
7ecea5fa5c
@ -60,9 +60,12 @@ gameplayLoopAngle:
|
|||||||
gameplayLoopFire:
|
gameplayLoopFire:
|
||||||
|
|
||||||
lda fireRequested
|
lda fireRequested
|
||||||
beq gameplayLoopEndFrame
|
beq gameplayLoopProjectiles
|
||||||
jsr fire
|
jsr fire
|
||||||
|
|
||||||
|
gameplayLoopProjectiles:
|
||||||
|
jsr updateProjectiles
|
||||||
|
|
||||||
gameplayLoopEndFrame:
|
gameplayLoopEndFrame:
|
||||||
|
|
||||||
lda quitRequested
|
lda quitRequested
|
||||||
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
2
player.s
2
player.s
@ -11,7 +11,7 @@ playerData:
|
|||||||
.word 40 ; X pos in pixels (from left terrain edge)
|
.word 40 ; X pos in pixels (from left terrain edge)
|
||||||
.word 38 ; Y pos in pixels (from bottom terrain edge)
|
.word 38 ; Y pos in pixels (from bottom terrain edge)
|
||||||
|
|
||||||
.word 90+45 ; Angle in degrees from +X
|
.word 45 ; Angle in degrees from +X
|
||||||
.word 50 ; Power
|
.word 50 ; Power
|
||||||
|
|
||||||
PD_POSX = 0 ; Byte offsets into player data structure
|
PD_POSX = 0 ; Byte offsets into player data structure
|
||||||
|
78
projectile.s
78
projectile.s
@ -8,13 +8,20 @@
|
|||||||
|
|
||||||
projectileData:
|
projectileData:
|
||||||
; gameobject data
|
; gameobject data
|
||||||
.word 40 ; X pos in pixels (from left terrain edge)
|
.word -1 ; Pos X in pixels (from left terrain edge)
|
||||||
.word 38 ; Y pos in pixels (from bottom terrain edge)
|
.word 0 ; Pos Y in pixels (from bottom terrain edge)
|
||||||
|
|
||||||
|
.word 0 ; Pos X (8.8 fixed point)
|
||||||
|
.word 0 ; Pos Y (8.8 fixed point)
|
||||||
.word 0 ; Velocity X (8.8 fixed point)
|
.word 0 ; Velocity X (8.8 fixed point)
|
||||||
.word 0 ; Velocity Y (8.8 fixed point)
|
.word 0 ; Velocity Y (8.8 fixed point)
|
||||||
|
|
||||||
JD_V = 4 ; Byte offsets into projectile data structure
|
JD_POSX = 0 ; Byte offsets into projectile data structure
|
||||||
|
JD_POSY = 2
|
||||||
|
JD_PRECISEX = 4
|
||||||
|
JD_PRECISEY = 6
|
||||||
|
JD_VX = 8
|
||||||
|
JD_VY = 10
|
||||||
|
|
||||||
|
|
||||||
projectileParams:
|
projectileParams:
|
||||||
@ -46,6 +53,18 @@ fireProjectile:
|
|||||||
iny
|
iny
|
||||||
iny
|
iny
|
||||||
|
|
||||||
|
lda projectileParams ; Fixed point version of X pos
|
||||||
|
xba
|
||||||
|
sta (SCRATCHL),y
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
|
||||||
|
lda projectileParams+2 ; Fixed point version of Y pos
|
||||||
|
xba
|
||||||
|
sta (SCRATCHL),y
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
|
||||||
lda projectileParams+4 ; Convert angle to vector
|
lda projectileParams+4 ; Convert angle to vector
|
||||||
asl
|
asl
|
||||||
tax
|
tax
|
||||||
@ -61,9 +80,54 @@ fireProjectile:
|
|||||||
lda angleToVectorY,x ; Velocity Y
|
lda angleToVectorY,x ; Velocity Y
|
||||||
sta (SCRATCHL),y
|
sta (SCRATCHL),y
|
||||||
|
|
||||||
brk
|
RESTORE_AXY
|
||||||
fireProjectileLoop:
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; updateProjectiles
|
||||||
|
;
|
||||||
|
; Trashes SCRATCHL
|
||||||
|
;
|
||||||
|
updateProjectiles:
|
||||||
|
SAVE_AXY
|
||||||
|
lda projectileData+JD_POSX
|
||||||
|
bmi updateProjectilesDone
|
||||||
|
|
||||||
|
; Integrate X velocity over position
|
||||||
|
lda projectileData+JD_PRECISEX
|
||||||
|
clc
|
||||||
|
adc projectileData+JD_VX
|
||||||
|
sta projectileData+JD_PRECISEX
|
||||||
|
|
||||||
|
; Convert to integral for rendering
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
sta projectileData+JD_POSX
|
||||||
|
|
||||||
|
; Integrate Y velocity over position
|
||||||
|
lda projectileData+JD_PRECISEY
|
||||||
|
clc
|
||||||
|
adc projectileData+JD_VY
|
||||||
|
sta projectileData+JD_PRECISEY
|
||||||
|
|
||||||
|
; Convert to integral for rendering
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
sta projectileData+JD_POSY
|
||||||
|
brk
|
||||||
|
updateProjectilesDone:
|
||||||
RESTORE_AXY
|
RESTORE_AXY
|
||||||
rts
|
rts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user