crazygrouptrio
Active member
Okay so, I'm horrible at script. But I have this player death script almost working and just need some advice for its execution. Basically when a player dies the other player gets a point and they warp to the next screen(warping is handled in the player action) with full health. Right now it at least seems to work fine for player 1, but player 2's score never goes up so I'm obviously missing a line of code to count for that player (but it doesn't count to player 1 so I must be close?) The HUD stuff is set correctly as well.
Here's my playerdeath script as it is (it's probably a mess)
Dale's original code has both players sharing the deactivateobject/createobject line, but in my game it would produce a second sprite of the still living player when the other died so I split it, which fixed it, but probably created my current problem?
Also player 1's health meter never goes down to 0. They still die correctly, but the HUD shows they have 1 life left each time. Not sure why that is either...
Any help would be appreciated!
EDIT: After some experimenting I've gotten some differing results:
1. Player 1 kills player 2, works fine.
2. Player 2 kills player 1, no score is added.
3. Monsters killing the player usually work as above, but on 1 occasion it scored player 2 correctly? (and yes I want the monster killing the player to count towards the living player)
May be more going on here than this one script... I can upload a video of whats happening if any of this is confusing. Again, any insight is appreciated! :?
Here's my playerdeath script as it is (it's probably a mess)
Code:
TXA
STA tempx
TYA
STA tempy
;;;;;;;;;;;;;;;;;;;
;LDX player1_object ;;dale_coop player object is already in x ?
LDA player2Mode
BEQ +
CPX player2_object
BNE +
;; is player 2
LDA #$FF
STA player2_object
LDA #$00
STA myHealth2
;; Update HUD:
STA hudElementTilesToLoad
AddValue #$03, P1Score, #$01, #$00
UpdateHud HUD_P1Score
UpdateHud HUD_myHealth2
LDA #$01
STA temp3
+
LDA Object_x_hi,x
STA temp
LDA Object_y_hi,x
STA temp1
DeactivateCurrentObject
CreateObject temp, temp1, #OBJ_PLAYER_DEATH, temp3, currentNametable
JMP ++
+
;; is player 1
LDA #$FF
STA player1_object
LDA #$00
STA myHealth1
;; Update HUD:
STA hudElementTilesToLoad
AddValue #$05, P2Score, #$01, #$00
UpdateHud HUD_P2Score
UpdateHud HUD_myHealth1
LDA #$00
STA temp3
+
LDA Object_x_hi,x
STA temp
LDA Object_y_hi,x
STA temp1
DeactivateCurrentObject
CreateObject temp, temp1, #OBJ_PLAYER_DEATH, temp3, currentNametable
++
;;;;;;;;;;;;;;;;;;;
;StopSound
;PlaySound #$00, #$00
LDA #$05
STA myHealth1
+
LDA #$05
STA myHealth2
+
LDX tempx
LDY tempy
PlaySound #SND_DEATH_PLAYER
;; if ALL dead, it's finished
;; player 2 dead?
; LDA player2_object
; CLC
; CMP #$FF
; BNE +
; player 1 dead?
; LDA player1_object
; CLC
; CMP #$FF
; BNE +
; JSR LoseLife
; +
RTS
Also player 1's health meter never goes down to 0. They still die correctly, but the HUD shows they have 1 life left each time. Not sure why that is either...
Any help would be appreciated!
EDIT: After some experimenting I've gotten some differing results:
1. Player 1 kills player 2, works fine.
2. Player 2 kills player 1, no score is added.
3. Monsters killing the player usually work as above, but on 1 occasion it scored player 2 correctly? (and yes I want the monster killing the player to count towards the living player)
May be more going on here than this one script... I can upload a video of whats happening if any of this is confusing. Again, any insight is appreciated! :?