SOLVED (4.5.9.) Countdown Timer in Maze Module

Arctic Blizzard

New member
NESmaker 4.5.9 version - Game Timer
Here it is. This is the best I could do. And thanks again 5kids2feed & Dale_Coop!!! A game timer that counts down kind of Mario style where when it gets to zero it takes 1 life away and restarts the level. I'm still learning how to cut up code and use the macros for help. Its a fun learning process. Hope this script helps.
NESmaker 4.5.9 version



;;; Do Handle Game Timer My Lives (DALE COOP, 5kids2feed, ARCTIC BLIZZARD collab)

;;; What this script does is the Game Timer counts down. When timer reaches zero you will lose one life and the game will reset to the last continue point.



;;;Game Timer Ticks
LDA gameTimerTicks
CLC
ADC #$04 ;how fast the Game Timer will tick
STA gameTimerTicks
BCC +normalwhatever

;No Game Timer on Screen Flags.
LDA ScreenFlags00
AND #%01000000 ;; if "hide hud" is set.
BNE +normalwhatever ;; skip all the code related to myTimer

;;;Hud Game Timer Value
SubtractValue #$02, myTimer, #$1, #$00
;;arg0 = how places value has
;;arg1 - home variable
;;arg2 = amount to subtract
;;arg3 = what place value is receiving subtaction
UpdateHudElement #$02

+normalwhatever

;;;Game Timer 1's, & 10's place
LDA gameTimerLo
ADC #$09 ;this represents the 1's place in the timer.
STA gameTimerLo
LDA gameTimerHi
ADC #$09 ;this represents the 10's place in the timer.
STA gameTimerHi

;;; checking the value of the Game Timer:
LDA myTimer_10
BNE +notEnded
LDA myTimer
BNE +notEnded
;; when Game Timer reaches 00.

;; this is what will happen. Level will start over and you will lose one life.


ChangeActionStep player1_object, #$07
;arg0 = what object?
;arg1 = what step?

JSR doChangeActionStep
;;Level will start over and you will lose one life.



+notEnded:


;;;;Special Thanks to NESmaker Community; Dale Coop & 5Kids2feed for helping to create this script.
 
Last edited:

Arctic Blizzard

New member
NESmaker 4.5.9 version - Game Timer - Post Screen Load
Also if anyone wants to use the Game Timer make sure to put this script in your PostScreenLoad script so your timer resets to the time you set.
NESmaker 4.5.9 version




;; initialize the Game Timer to 99

UpdateHudElement #$02
LDA #$9
STA myTimer
LDA #$9
STA myTimer_10
 

XavierOrionGames

New member
Thanks guys for this...i'm extremely new to NES Maker (like started tinkering with it 2 days ago). After going thru 12 Days of NESmas i got inspired to start porting over my Xbox One game Loony Lawns ,and i couldn't find a way to do create a timer (in my case fuel countdown) until i came across your thread. Curious question my original game also had a mode where as you cut the grass instead of the fuel counting down the fuel would be consumed by 1 for each uncut grass tile you touched if you touched an already cut grass tile you would be penalized by losing 2 units of fuel.

I currently have the uncut tiles marked out as prize but when i try to set it up to have it count down a unit of fuel once you touch it along with adding points to your score i cant seem to get it effect both variables on one tile type. It maybe something very elementary that I'm not aware of especially considering im just barely even attempting to start to understand the coding for this.

Anyway thank you so much for having this script available
 

Attachments

  • Screenshot (141).png
    Screenshot (141).png
    22.4 KB · Views: 9
  • Screenshot (142).png
    Screenshot (142).png
    22.4 KB · Views: 9

dale_coop

Moderator
Staff member
You can't have 2 HUD variables updated at the same time... you'll have to find a creative way to do that (maybe your timer script could update your score variable or your fuel variable at a regular interval)
 

XavierOrionGames

New member
You can't have 2 HUD variables updated at the same time... you'll have to find a creative way to do that (maybe your timer script could update your score variable or your fuel variable at a regular interval)
I'll just have to base the game off the arcade mode only of the original version of the game. In the original there was a Puzzle Mode which you had a set amount of fuel ,and set amount of fuel tanks available in a level so you had to find the best route to cut all the grass in the level without backtracking over previously cut patches as you would get a fuel penalty. So each uncut grass tile ate up 1 unit of fuel where as back tracking took 2.

In arcade mode the fuel just acted as a timer ,and fuel tanks would randomly spawn in and you would collect them. In that there was no penalties for going over cut patches. So i'm likely just going to base this version off the arcade mode only. (Which how the current prototype is setup)

Now i just need to figure out how to get the fuel to spawn in random places ,and how to get the game to know how many uncut tiles there are when to know when all the tiles are in cut status so it can advance to the next level.
 

BITVADER

New member
I'm trying the code provided in this thread, but it doesn't seem to implement it well.
My game hides the HUD so I can't see if the countdown is working and I'm not sure where it's failing.
I would like to know if you know the booby trap that is easy to fall into when implementing the countdown timer for the first time.
 
Top Bottom