mirror of
https://github.com/blondie7575/GSCats.git
synced 2025-01-10 10:29:25 +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 $000FF000
|
||||
|
||||
s_CloseParen:
|
||||
qbyte $000FF000
|
||||
qbyte $0000FF00
|
||||
qbyte $00000FF0
|
||||
qbyte $00000FF0
|
||||
qbyte $0000FF00
|
||||
qbyte $000FF000
|
||||
s_CloseParen: ; Anger symbol
|
||||
qbyte $0F0000F0
|
||||
qbyte $00F00F00
|
||||
qbyte $00000000
|
||||
qbyte $00FFFF00
|
||||
qbyte $0F0000F0
|
||||
qbyte $F000000F
|
||||
|
||||
|
||||
s_Asterix:
|
||||
qbyte $00000000
|
||||
qbyte $00F0F0F0
|
||||
qbyte $000FFF00
|
||||
qbyte $00000000 ; Angle symbol
|
||||
qbyte $00000FF0
|
||||
qbyte $0000FF00
|
||||
qbyte $000FF000
|
||||
qbyte $00FFFFF0
|
||||
qbyte $000FFF00
|
||||
qbyte $00F0F0F0
|
||||
qbyte $00000000
|
||||
|
||||
s_Plus:
|
||||
s_Plus: ; Power symbol
|
||||
qbyte $000F0000
|
||||
qbyte $000F0000
|
||||
qbyte $0FFFFF00
|
||||
|
@ -52,7 +52,6 @@ gameplayLoop:
|
||||
jsr renderPlayers
|
||||
|
||||
gameplayLoopKbd:
|
||||
|
||||
; Check for keys down
|
||||
jsr kbdScan
|
||||
|
||||
@ -62,14 +61,12 @@ gameplayLoopKbd:
|
||||
jsr scrollMap
|
||||
|
||||
gameplayLoopAngle:
|
||||
|
||||
; Update aim angle if needed
|
||||
lda angleDeltaRequested
|
||||
beq gameplayLoopFire
|
||||
jsr changeAngle
|
||||
|
||||
gameplayLoopFire:
|
||||
|
||||
lda fireRequested
|
||||
beq gameplayLoopProjectiles
|
||||
jsr fire
|
||||
@ -80,9 +77,14 @@ gameplayLoopProjectiles:
|
||||
jsr renderProjectiles
|
||||
|
||||
lda turnRequested
|
||||
beq gameplayLoopEndFrame
|
||||
beq gameplayLoopVictoryCondition
|
||||
jsr endTurn
|
||||
|
||||
gameplayLoopVictoryCondition:
|
||||
lda gameOver
|
||||
bmi gameplayLoopEndFrame
|
||||
jsr endGame
|
||||
|
||||
gameplayLoopEndFrame:
|
||||
lda quitRequested
|
||||
beq gameplayLoop
|
||||
@ -112,6 +114,17 @@ endTurnWrap:
|
||||
bra endTurnRefresh
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; endGame
|
||||
;
|
||||
; Handles someone winning
|
||||
;
|
||||
endGame:
|
||||
lda #1
|
||||
sta quitRequested
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; scrollMap
|
||||
;
|
||||
@ -184,6 +197,8 @@ activePlayer:
|
||||
.word 0
|
||||
currentPlayer:
|
||||
.word 0
|
||||
gameOver:
|
||||
.word -1 ; Player index of winner
|
||||
|
||||
|
||||
; 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 50 ; Power
|
||||
.word 100 ; Anger
|
||||
.byte 8,"SPROCKET " ; Name
|
||||
.word 0,0,0,0,0,0,0 ;Padding
|
||||
.word 0,0,0,0,0,0 ;Padding
|
||||
|
||||
; gameobject data
|
||||
.word 0 ; X pos in pixels (from left terrain edge)
|
||||
@ -24,12 +25,14 @@ playerData:
|
||||
|
||||
.word 45 ; Angle in degrees from +X
|
||||
.word 50 ; Power
|
||||
.word 100 ; Anger
|
||||
.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_POWER = 38
|
||||
PD_NAME = 40
|
||||
PD_ANGER = 40
|
||||
PD_NAME = 42
|
||||
PD_SIZE = 64
|
||||
|
||||
.macro PLAYERPTR_Y
|
||||
@ -176,23 +179,33 @@ renderPlayerHeader:
|
||||
jsr DrawString
|
||||
|
||||
lda playerData+PD_ANGLE,y
|
||||
ldx #72
|
||||
ldx #56
|
||||
jsr drawNumber
|
||||
|
||||
ldx #96
|
||||
ldx #68
|
||||
lda #powerStr
|
||||
jsr DrawString
|
||||
|
||||
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
|
||||
|
||||
RESTORE_AXY
|
||||
rts
|
||||
|
||||
angleStr:
|
||||
pstring "ANGLE: "
|
||||
pstring "*: "
|
||||
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 ; Velocity X (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_PRECISEY = 38
|
||||
JD_VX = 40
|
||||
JD_VY = 42
|
||||
JD_TYPE = 44
|
||||
|
||||
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
|
||||
tya ; Pointer to projectile structure from index
|
||||
@ -34,6 +43,13 @@ GRAVITY = $ffff ; 8.8 fixed point
|
||||
tay
|
||||
.endmacro
|
||||
|
||||
.macro PROJECTILETYPEPTR_Y
|
||||
tya ; Pointer to projectile type structure from index
|
||||
asl
|
||||
asl
|
||||
tay
|
||||
.endmacro
|
||||
|
||||
|
||||
|
||||
projectileParams:
|
||||
@ -213,7 +229,7 @@ updateProjectilesDelete:
|
||||
bra updateProjectilesDone
|
||||
|
||||
updateProjectilesPlayerHit:
|
||||
brk
|
||||
jsr processPlayerImpact
|
||||
bra updateProjectilesDelete
|
||||
|
||||
updateProjectilesTerrainHit:
|
||||
@ -267,3 +283,34 @@ unrenderProjectilesDoIt:
|
||||
unrenderProjectilesDone:
|
||||
pla
|
||||
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…
x
Reference in New Issue
Block a user