crazygrouptrio
Active member
I've been messing with scripts trying to polish things up, and during this I messed something up somehow.
The game resets when the player dies, when it should reload the current screen. My game does not use Lives, and I think that might've been accidentally implemented somewhere? But I can't find where I may have done it.
Here are my death scripts...
HandlePlayerDeath:
CreateDeathObject
I was messing with my game timer when I noticed it was all messed up. Basically I'm just setting it up so when the timer runs out it warps to a specific screen to start a "game over" cutscene. (which it does work actually) Although I haven't figured out how to reset the timer so the event can occur. So right now the timer is a zero so it just keeps warping the player over and over instead of letting the cutscene finish. I have that part commented out at the moment until I fix this other problem using the JMP Reset as the game did before. So that reset isn't the problem at least... Anyway here's the timer script...
I also just implemented a code provided by Dale for adding a normal/difficult mode. It DOES affect lives but I commented those parts out, maybe I did that wrong? I'll add my StartGame script here anyway...
Hope someone can help me out. After messing with this for hours I'm kind of lost...
The game resets when the player dies, when it should reload the current screen. My game does not use Lives, and I think that might've been accidentally implemented somewhere? But I can't find where I may have done it.
Here are my death scripts...
HandlePlayerDeath:
Code:
;;; do warp to continue screen stuff here.
LDA #$00
STA newGameState
LDA continueMap
clc
ADC #$01
STA temp
GoToScreen continueScreen, temp, #$04
LDA #$00
STA playerToSpawn
; LDX player1_object
DeactivateCurrentObject
LDA #$01
STA loadObjectFlag
LDA continuePositionX
STA newX
LDA continuePositionY
STA newY
; reset keys to 0
LDA #$00
STA myKeys
+
Code:
;;;
TXA
STA tempx
TYA
STA tempy
;;;;;;;;;;;;;;;;;;;
LDX player1_object
LDA Object_x_hi,x
STA temp
LDA Object_y_hi,x
STA temp1
DeactivateCurrentObject
CreateObject temp, temp1, #OBJ_PLAYER_DEATH, #$00, currentNametable
;;;;;;;;;;;;;;;;;;;
;StopSound
PlaySound #sfx_ouch
LDA #$FF
STA player1_object
LDX tempx
LDY tempy
I was messing with my game timer when I noticed it was all messed up. Basically I'm just setting it up so when the timer runs out it warps to a specific screen to start a "game over" cutscene. (which it does work actually) Although I haven't figured out how to reset the timer so the event can occur. So right now the timer is a zero so it just keeps warping the player over and over instead of letting the cutscene finish. I have that part commented out at the moment until I fix this other problem using the JMP Reset as the game did before. So that reset isn't the problem at least... Anyway here's the timer script...
Code:
;; create a variable in your HUD called myTimer
;; set the initial value for myTimer from your HUD
;; myTimer needs to have a max value of 3
;; this script was used for NESMAKER 4.1.1 and calls the SubtractValue macro
;; make sure that SubtractValue is the *proper* version
;; This script wouldn't be possible without Kevin Skeen's Timer_Tick.asm script
;; Thank you for everything, Kevin Skeen!
HandleGameTimer:
DEC gameTimer ;decrement memory by one
BNE dontUpdateGameTimer ;if gameTimer = 0, don't update
LDA gameTimerLo ;load gameTimerLo into accumulator
CLC ;clear the carry flag
ADC #$01 ;add 01 to acumulator with carry
STA gameTimerLo ;store to the accumlator
LDA gameTimerHi ;load gameTimerHi into accumulator
ADC #$00 ;add 00 to acumulator with carry
STA gameTimerHi ;store to the accumlator
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DO WHATEVER READS OF THE GAMETIMER YOU MIGHT WANT HERE.
;; skip the timer if special screen:
LDA update_screen_details
BEQ dontUpdateGameTimer
LDX #$02 ;;Checking Hundreds
LDA myTimer,x ;;Load Hundreds Digit
BNE SubtractTime ;;If not 0, we have more than 000
DEX ;;Checking Tens -- Decrease x so x is 1
LDA myTimer,x ;;Load Tens Digit
BNE SubtractTime ;;If not 0, we have more than 000
DEX ;;Checking Tens
LDA myTimer,x ;;Load Ones Digit
BNE SubtractTime
JMP RESET ;;this is what happens when the time is zero
;LDA #$00
;STA newGameState
;STA change_state
;GoToScreen #GAME_OVER, #$01, #$02
; JSR DeactivateAllObjects
;LDA #$01
;STA loadObjectFlag
;+
;;;;;;;;;;;;;;;;;;;;;;;;;;;
LDA #DayNightSpeed
STA gameTimer
dontUpdateGameTimer:
RTS
SubtractTime:
SubtractValue #$03, myTimer, #$01, #$00 ;;Subtract 1 from the Ones digit
;;Update HUD
LDA #$03 ;; your timer can only have max 3 numbers
STA hudElementTilesToLoad
LDA DrawHudBytes
ORA #HUD_myTimer
STA DrawHudBytes
RTS
DoAlarm:
;;; we're going to edge-load monsters one at a time if they are of edge type and are not active.
LDX #$00
doLoadMonsterOnTimerLoop:
LDA edgeLoaderInCue
BEQ noEdgeMonstersInCue
LDA currentBank
STA prevBank
LDY #$1C ;; data bank
JSR bankswitchY
JSR CreateTimedEdgeSpawner
DEC edgeLoaderInCue
LDY prevBank
JSR bankswitchY
noEdgeMonstersInCue
RTS
I also just implemented a code provided by Dale for adding a normal/difficult mode. It DOES affect lives but I commented those parts out, maybe I did that wrong? I'll add my StartGame script here anyway...
Code:
LDA #STATE_START_GAME
STA change_state
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SELECTION MODE :
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; curSelection is 0 (normal) or curSelection is 1 (hard):
LDA curSelection
CMP #$01
BNE +
;; Start in HARD mode:
;LDA #$01
;STA myLives
;; WARP to the HARD_START_LEVEL screen (in overworld)
LDA #$00
;STA newGameState
STA change_state
GoToScreen #HARD_START_LEVEL, #$01, #$02
JSR DeactivateAllObjects
LDA #$01
STA loadObjectFlag
+
;; from here the rest of the code:
JMP ++
+
;; ELSE:
;; Start in NORMAL mode :
;LDA #$03 ;; commented out, here, in order to use the value specified in the NESMaker tool itself
;STA myLives ;; commented out, here, in order to use the value specified in the NESMaker tool itself
++
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;StopSound
;PlaySound #$00, $00
LDA #%10000000
STA gameHandler ;; turn sprites on
RTS
-----
Hope someone can help me out. After messing with this for hours I'm kind of lost...