mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-05-31 19:41:29 +00:00
Added player damage and death
This commit is contained in:
parent
72f724ff29
commit
dec9f3e2c8
26
font.s
26
font.s
|
@ -235,24 +235,24 @@ s_OpenParen:
|
||||||
qbyte $00FF0000
|
qbyte $00FF0000
|
||||||
qbyte $000FF000
|
qbyte $000FF000
|
||||||
|
|
||||||
s_CloseParen:
|
s_CloseParen: ; Anger symbol
|
||||||
qbyte $000FF000
|
qbyte $0F0000F0
|
||||||
qbyte $0000FF00
|
qbyte $00F00F00
|
||||||
qbyte $00000FF0
|
qbyte $00000000
|
||||||
qbyte $00000FF0
|
qbyte $00FFFF00
|
||||||
qbyte $0000FF00
|
qbyte $0F0000F0
|
||||||
qbyte $000FF000
|
qbyte $F000000F
|
||||||
|
|
||||||
|
|
||||||
s_Asterix:
|
s_Asterix:
|
||||||
qbyte $00000000
|
qbyte $00000000 ; Angle symbol
|
||||||
qbyte $00F0F0F0
|
qbyte $00000FF0
|
||||||
qbyte $000FFF00
|
qbyte $0000FF00
|
||||||
|
qbyte $000FF000
|
||||||
qbyte $00FFFFF0
|
qbyte $00FFFFF0
|
||||||
qbyte $000FFF00
|
qbyte $00000000
|
||||||
qbyte $00F0F0F0
|
|
||||||
|
|
||||||
s_Plus:
|
s_Plus: ; Power symbol
|
||||||
qbyte $000F0000
|
qbyte $000F0000
|
||||||
qbyte $000F0000
|
qbyte $000F0000
|
||||||
qbyte $0FFFFF00
|
qbyte $0FFFFF00
|
||||||
|
|
|
@ -52,7 +52,6 @@ gameplayLoop:
|
||||||
jsr renderPlayers
|
jsr renderPlayers
|
||||||
|
|
||||||
gameplayLoopKbd:
|
gameplayLoopKbd:
|
||||||
|
|
||||||
; Check for keys down
|
; Check for keys down
|
||||||
jsr kbdScan
|
jsr kbdScan
|
||||||
|
|
||||||
|
@ -62,14 +61,12 @@ gameplayLoopKbd:
|
||||||
jsr scrollMap
|
jsr scrollMap
|
||||||
|
|
||||||
gameplayLoopAngle:
|
gameplayLoopAngle:
|
||||||
|
|
||||||
; Update aim angle if needed
|
; Update aim angle if needed
|
||||||
lda angleDeltaRequested
|
lda angleDeltaRequested
|
||||||
beq gameplayLoopFire
|
beq gameplayLoopFire
|
||||||
jsr changeAngle
|
jsr changeAngle
|
||||||
|
|
||||||
gameplayLoopFire:
|
gameplayLoopFire:
|
||||||
|
|
||||||
lda fireRequested
|
lda fireRequested
|
||||||
beq gameplayLoopProjectiles
|
beq gameplayLoopProjectiles
|
||||||
jsr fire
|
jsr fire
|
||||||
|
@ -80,9 +77,14 @@ gameplayLoopProjectiles:
|
||||||
jsr renderProjectiles
|
jsr renderProjectiles
|
||||||
|
|
||||||
lda turnRequested
|
lda turnRequested
|
||||||
beq gameplayLoopEndFrame
|
beq gameplayLoopVictoryCondition
|
||||||
jsr endTurn
|
jsr endTurn
|
||||||
|
|
||||||
|
gameplayLoopVictoryCondition:
|
||||||
|
lda gameOver
|
||||||
|
bmi gameplayLoopEndFrame
|
||||||
|
jsr endGame
|
||||||
|
|
||||||
gameplayLoopEndFrame:
|
gameplayLoopEndFrame:
|
||||||
lda quitRequested
|
lda quitRequested
|
||||||
beq gameplayLoop
|
beq gameplayLoop
|
||||||
|
@ -112,6 +114,17 @@ endTurnWrap:
|
||||||
bra endTurnRefresh
|
bra endTurnRefresh
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; endGame
|
||||||
|
;
|
||||||
|
; Handles someone winning
|
||||||
|
;
|
||||||
|
endGame:
|
||||||
|
lda #1
|
||||||
|
sta quitRequested
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; scrollMap
|
; scrollMap
|
||||||
;
|
;
|
||||||
|
@ -184,6 +197,8 @@ activePlayer:
|
||||||
.word 0
|
.word 0
|
||||||
currentPlayer:
|
currentPlayer:
|
||||||
.word 0
|
.word 0
|
||||||
|
gameOver:
|
||||||
|
.word -1 ; Player index of winner
|
||||||
|
|
||||||
|
|
||||||
; Position of map viewing window. Can be visualized in two ways:
|
; Position of map viewing window. Can be visualized in two ways:
|
||||||
|
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
29
player.s
29
player.s
|
@ -14,8 +14,9 @@ playerData:
|
||||||
|
|
||||||
.word 45 ; Angle in degrees from +X
|
.word 45 ; Angle in degrees from +X
|
||||||
.word 50 ; Power
|
.word 50 ; Power
|
||||||
|
.word 100 ; Anger
|
||||||
.byte 8,"SPROCKET " ; Name
|
.byte 8,"SPROCKET " ; Name
|
||||||
.word 0,0,0,0,0,0,0 ;Padding
|
.word 0,0,0,0,0,0 ;Padding
|
||||||
|
|
||||||
; gameobject data
|
; gameobject data
|
||||||
.word 0 ; X pos in pixels (from left terrain edge)
|
.word 0 ; X pos in pixels (from left terrain edge)
|
||||||
|
@ -24,12 +25,14 @@ playerData:
|
||||||
|
|
||||||
.word 45 ; Angle in degrees from +X
|
.word 45 ; Angle in degrees from +X
|
||||||
.word 50 ; Power
|
.word 50 ; Power
|
||||||
|
.word 100 ; Anger
|
||||||
.byte 8,"TINKER " ; Name
|
.byte 8,"TINKER " ; Name
|
||||||
.word 0,0,0,0,0,0,0 ;Padding
|
.word 0,0,0,0,0,0 ;Padding
|
||||||
|
|
||||||
PD_ANGLE = 36
|
PD_ANGLE = 36
|
||||||
PD_POWER = 38
|
PD_POWER = 38
|
||||||
PD_NAME = 40
|
PD_ANGER = 40
|
||||||
|
PD_NAME = 42
|
||||||
PD_SIZE = 64
|
PD_SIZE = 64
|
||||||
|
|
||||||
.macro PLAYERPTR_Y
|
.macro PLAYERPTR_Y
|
||||||
|
@ -176,23 +179,33 @@ renderPlayerHeader:
|
||||||
jsr DrawString
|
jsr DrawString
|
||||||
|
|
||||||
lda playerData+PD_ANGLE,y
|
lda playerData+PD_ANGLE,y
|
||||||
ldx #72
|
ldx #56
|
||||||
jsr drawNumber
|
jsr drawNumber
|
||||||
|
|
||||||
ldx #96
|
ldx #68
|
||||||
lda #powerStr
|
lda #powerStr
|
||||||
jsr DrawString
|
jsr DrawString
|
||||||
|
|
||||||
lda playerData+PD_POWER,y
|
lda playerData+PD_POWER,y
|
||||||
ldx #120
|
ldx #76
|
||||||
|
jsr drawNumber
|
||||||
|
|
||||||
|
ldx #88
|
||||||
|
lda #angerStr
|
||||||
|
jsr DrawString
|
||||||
|
|
||||||
|
lda playerData+PD_ANGER,y
|
||||||
|
ldx #96
|
||||||
jsr drawNumber
|
jsr drawNumber
|
||||||
|
|
||||||
RESTORE_AXY
|
RESTORE_AXY
|
||||||
rts
|
rts
|
||||||
|
|
||||||
angleStr:
|
angleStr:
|
||||||
pstring "ANGLE: "
|
pstring "*: "
|
||||||
powerStr:
|
powerStr:
|
||||||
pstring "POWER: "
|
pstring "+: "
|
||||||
|
angerStr:
|
||||||
|
pstring "): "
|
||||||
|
|
||||||
|
|
||||||
|
|
49
projectile.s
49
projectile.s
|
@ -16,14 +16,23 @@ projectileData:
|
||||||
.word 0 ; Pos Y (12.4 fixed point)
|
.word 0 ; Pos Y (12.4 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)
|
||||||
|
.word 0 ; Type
|
||||||
|
|
||||||
JD_PRECISEX = 36 ; Byte offsets into projectile data structure
|
JD_PRECISEX = 36 ; Byte offsets into projectile data structure
|
||||||
JD_PRECISEY = 38
|
JD_PRECISEY = 38
|
||||||
JD_VX = 40
|
JD_VX = 40
|
||||||
JD_VY = 42
|
JD_VY = 42
|
||||||
|
JD_TYPE = 44
|
||||||
|
|
||||||
GRAVITY = $ffff ; 8.8 fixed point
|
GRAVITY = $ffff ; 8.8 fixed point
|
||||||
|
|
||||||
|
projectileTypes: ; Byte offsets into projectile type data structure
|
||||||
|
.word 50 ; Damage
|
||||||
|
.word 0,0,0 ; Padding
|
||||||
|
|
||||||
|
PT_DAMAGE = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.macro PROJECTILEPTR_Y
|
.macro PROJECTILEPTR_Y
|
||||||
tya ; Pointer to projectile structure from index
|
tya ; Pointer to projectile structure from index
|
||||||
|
@ -34,6 +43,13 @@ GRAVITY = $ffff ; 8.8 fixed point
|
||||||
tay
|
tay
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
.macro PROJECTILETYPEPTR_Y
|
||||||
|
tya ; Pointer to projectile type structure from index
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
tay
|
||||||
|
.endmacro
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
projectileParams:
|
projectileParams:
|
||||||
|
@ -213,7 +229,7 @@ updateProjectilesDelete:
|
||||||
bra updateProjectilesDone
|
bra updateProjectilesDone
|
||||||
|
|
||||||
updateProjectilesPlayerHit:
|
updateProjectilesPlayerHit:
|
||||||
brk
|
jsr processPlayerImpact
|
||||||
bra updateProjectilesDelete
|
bra updateProjectilesDelete
|
||||||
|
|
||||||
updateProjectilesTerrainHit:
|
updateProjectilesTerrainHit:
|
||||||
|
@ -267,3 +283,34 @@ unrenderProjectilesDoIt:
|
||||||
unrenderProjectilesDone:
|
unrenderProjectilesDone:
|
||||||
pla
|
pla
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; processPlayerImpact
|
||||||
|
;
|
||||||
|
; Y = Byte offset of player that was hit
|
||||||
|
;
|
||||||
|
processPlayerImpact:
|
||||||
|
tyx
|
||||||
|
|
||||||
|
ldy #0 ; Assume projectile 0
|
||||||
|
PROJECTILEPTR_Y
|
||||||
|
lda projectileData+JD_TYPE,y
|
||||||
|
tay
|
||||||
|
PROJECTILETYPEPTR_Y
|
||||||
|
|
||||||
|
; Apply damage
|
||||||
|
lda playerData+PD_ANGER,x
|
||||||
|
sec
|
||||||
|
sbc projectileTypes+PT_DAMAGE,y
|
||||||
|
|
||||||
|
; Check for death
|
||||||
|
beq processPlayerImpactDeath
|
||||||
|
bmi processPlayerImpactDeath
|
||||||
|
sta playerData+PD_ANGER,x
|
||||||
|
rts
|
||||||
|
|
||||||
|
processPlayerImpactDeath:
|
||||||
|
lda currentPlayer
|
||||||
|
sta gameOver
|
||||||
|
rts
|
||||||
|
|
Loading…
Reference in New Issue
Block a user