Make the health does not recover when passing the level.

salgue79

New member
Since yesterday I have been at noon with this problem, and I do not know how to solve it. I used the simple platform game as a base, and what happens is that when you pass the level, health is restored, doing nothing. For example, if an enemy touches me, I only have 2 health points left, because when I pass the level, I have 3 health points again.
How could I avoid that, and continue to have 2 points of health?
Thank you very much in advance!!
 

dale_coop

Moderator
Staff member
Could you share more information about how you designed your game?
How do you "finish" a level? You have a "warp to screen" tile on your last screen? Or it's a single screen game and you need to get all the Collectable tiles?
Etc...
 

salgue79

New member
When you collect the objects, which are COLLECT, you go to the other level. It is like the Simple Plataform example.
 

dale_coop

Moderator
Staff member
Here's what you could try...

- Modify the "HUD_Element_Var_Image.asm" script assigned to the "Hud Element 0" in your "Project Settings > Script Settings":
2020-05-29-12-29-29-Project-Settings.png


And comment out (adding a ";" before the code ) the line 15, like this:
2020-05-29-13-25-31-Z-NESMaker-4-1-5-demos-Game-Engine-Data-Routines-Basic-System-Hud-Element-Scripts-H.png


- Now, modify the "HandleUpdateObject.asm" script that is located in the "GameEngineData\Routines\Basic\System" folder... from line 188 (or around), you should see:
Code:
			LDA #HUD_LOAD	
			AND #%01000000
			BEQ +

After those lines, add that code:
Code:
			LDA myHealth
			STA Object_health,x

It should now looks like that:
2020-05-29-13-30-25-Z-NESMaker-4-1-5-demos-Game-Engine-Data-Routines-Basic-System-Handle-Update-Objects.png



VoilĂ ! Now, your player should keep his health after complete a level.
 

dale_coop

Moderator
Staff member
Also, make sure that when you lose a life (the handle lose life script), you set back the health to its initial value
(take a look at the player lose life script in the topic about the Game Over special screen: http://nesmakers.com/viewtopic.php?p=12881#p12881)
 

salgue79

New member
It works now!! Simply with putting; in the first line. the rest were wrong.
Many thanks friend!! You are so big!!
 
Top Bottom