Input and Lives question with Maze Tutorial project

mAnthon

New member
New to NESMaker here, and don't know ASM but hoping to learn. I'm following tutorials but already have 2 questions I don't understand.

First, I would like to know how to have a simple Lives system. I see this done in other tutorials but it is not explained how to make it work. In the Maze tutorial, touching a monster resets the game. How do I make it so that touching a monster loses 1 life, and just resets the current room? After 3 lives are lost, then it resets the game?

Last, I see something weird with the input that I would like to fix. When moving left, I can press to diagonals Up/Left and Down/Left, and the player still moves left. This is perfect. But when moving right, pressing diagonals Up/Right moves right (perfect) but Down/Right moves the player Down. How do I make it so that rolling the input to Down/Right acts the same as the others and continues to move Right
 

dale_coop

Moderator
Staff member
For your movements... check the "Input Editor".
On the right, you will see the scripts that are executed when you press the buttons.
I think, in your case, the first 4 ones might be:
2019-06-21-00-36-09-NES-MAKER-4-1-5-Version-0x159-Projet-Non-Enregistr.png


Try to move the "StartMovingPlayerDown" to be in the second position, like this:
2019-06-21-00-36-41-NES-MAKER-4-1-5-Version-0x159-Projet-Non-Enregistr.png

I think it should make your movement working correctly (as you want).


And about your lives...
In order to do that you want, you will need to implement the checkpoint tile types (when your player loses a life, he spawns at the checkpoint... if no more lives, the game reset)
To do that, follow that tutorial: http://nesmakers.com/viewtopic.php?f=23&t=1953
(it was made for the Adventure module... but I think it would work for the Maze module)
 

Razzie.P

Member
I'm having a similar problem with the "lives" system as well. Followed the steps listed in the link Dale provided, but having no luck. Let us know if it works for you, please.
 

mAnthon

New member
Razzie.P said:
I'm having a similar problem with the "lives" system as well. Followed the steps listed in the link Dale provided, but having no luck. Let us know if it works for you, please.

No, it did not work. The Input solution worked, but adding lives and checkpoints is not working. I'm going to start over and try again when I get home to see if maybe something is wrong when building the tutorial. I'll update here if it works or not.
 

dale_coop

Moderator
Staff member
Guys, don't hesitate :) just tell us where you are now, what your scripts look like. What your settings are...maybe just a step you didn't do correctly.
Share screenshots, full scripts with your modifications, ...
To check and help you on that.
 

Razzie.P

Member
Sure thing. First, I started with the Maze module, completed the "Maze Game" 20 minute tutorial project, saved, and tested. No scripts have been changed and it works as it should. Now, following the steps you've provided to add lives and checkpoint --

1) -- I followed steps 1 - 6, setting the checkpoint constant and tiles, and adding myLives to the Hud. Here are the pics

0001.jpg

0002.jpg

0003.jpg

0004.jpg

0005.jpg


Now, when I run the game, these are the issues ---

1) When I start the game, the Lives correctly show 3, as shown int he 1st screenshot below. When I touch a monster and die, the lives correctly decreases by 1, but the music stops playing, and a digit is missing from the score. At this point, I'm stuck. I can still gather all the collectibles, but the game will not progress to the next stage. Also, if I get the "power up" and touch a monster, the game freezes entirely.

0006.jpg
0007.jpg


2) When I touch the checkpoint tile and then die, the lives decrease by 1, the music does NOT stop, but no monsters of game objects (such as the power up) are in the level. the score digit is missing, and a tile appears to the right of my "lives" that appears to be my "floor" asset with subpalette 4 applied.

0008.jpg

As always, thanks a million for any help you can provide. A basic lives system is, in my opinion, a necessity in creating these games so I'd very much like to get it working properly.
 

dale_coop

Moderator
Staff member
Ok... a lot of your issued comes from the triggerscreen line (when you collect and chan you checkpoint, your screen is actually triggered... maybe you don't want that in your game). So you will need to customize your scripts.

Make a new "setCheckpoint.asm" script in your "Basic\ModuleScripts\TileScripts\MazeGame" folder, with that code:
Code:
	CPX player1_object
	BEQ +
	JMP dontDoCheckpoint
+

	LDA Object_x_hi,x
	STA continuePositionX
	LDA Object_y_hi,x
	STA continuePositionY
	LDA currentMap
	STA continueMap
	LDA Object_scroll,x
	STA continueScreen
	PlaySound #SND_VICTORY
	;; TriggerScreen screenType
	ChangeTileAtCollision #$00, #TILE_CHECKPOINT_CLEARED
dontDoCheckpoint:

And assign that script to your "Collision Tile 09" in "Project Settings > Script Settings".


Then check your "CreatePlayerDeathObject.asm" script (the one assigned to your "Handle Player Death" element in "Project Settings > Script Settings"), you will find the line "StopSound". If you comment out that line:
Code:
  ;; StopSound
Your music will not stop playing when your player's dead.

And for your issue of collecting everything no more warping you to the next stage...
still in the "CreatePlayerDeathObject.asm" script, add those lines at the end of the script :
Code:
	LDA #$00
	STA screenPrizeCounter  ; reset to 0 the screenPrizeCounter collectables


Try those modifications... then, test again, and tell me, what issue remain (the hole in the score maybe....?).
 

Razzie.P

Member
Thanks a bunch! That seems to have done it. The "hole in the score" issue is a bit of a pain, and honestly makes no sense to me, but I seem to have found a way to patch it up as well. This may be a known issue, or maybe something elsewhere in my code is causing it, but it seems to have that strange behaviour based on which variable is set to "myScore" in the HUD, if that makes sense. At the default (Element 2, it causes the issue I mentioned above. Moving it around to other elements seems to introduce different issues. I finally found that moving to Element 3 seems to work properly. So I'm grateful that it's working, but I sure wish I knew what was causing it in case it happens again when I actually start creating a game.
 

dale_coop

Moderator
Staff member
Oh yeah, I remember now the "Element 2" has issues, (because of some hardcoded piece of code for it).
Drexegar had a similar issue some months ago: http://nesmakers.com/viewtopic.php?f=60&t=2210
The solution was o use another element (like you did) :p
 
Top Bottom