(4.5.2) Is there a 4.5 .asm for checkpoints?

voltopt

Member
I'd like to implement checkpoints after a player character loses a life, but before the life resets to zero. I see a lot of background for tile-based checkpoints, however this script does not come in the base module for 4.5.2. I'd like something where, after getting to a new 'area' or level, the game will send the player back to the start of the last level entered when a life is lost, as long as there are still lives to be lost.
 

james_dean

New member
I did it like this, as a tile the player walks across:

Code:
LDA camScreen
STA continueScreen

LDA currentWorld
STA continueMap

rts

camScreen is the current screen the game is on.

I have a user variable "currentWorld" that gets updated when the player warps, so it knows what map to start you back on. There's probably a variable hidden somewhere that keeps track of this anyway, but that was the easiest way I could do it.

This is using the standard hurt player script from the summer camp series, which has something like this at the end, so you shouldn't need to add anything there:

Code:
+myLivesNotZero:

	LDA continueMap
	STA warpMap
	
	LDA continueScreen
	STA currentNametable
	
	LDX player1_object
	STA Object_screen,x
	
	LDA #$02 ;; this is continue type warp.
	STA screenTransitionType ;; is of warp type

	
	LDA gameHandler
	ORA #%10000000
	STA gameHandler ;; this will set the next game loop to update the screen.

+skipHurt
 

voltopt

Member
Thank you! That works, although the player restarts on the checkpoint screen in the same position as they do on the initial start screen, not at the warp in point on that screen. I'll mess around and see if I can figure it out, I think it has to do with my continue with lives script, which just loads MainGame instead of GameOver when the player is hurt.
 

voltopt

Member
Also, as I'm new to NESmaker, I can't find where player death animations should go in the code in 4.5.2. I'm using hurtwithlives, and made a player death object and tried to load it after hurt in the code. I'm not sure this is the right way. Can I assign this animation in NESmaker or is it a code level deal?
 

dale_coop

Moderator
Staff member
"currentMap" gives you the current map ;)

for the death animation, it would be code level currently.
Keep it mind that this empty module is meant for be modified following the Summer Camps videos. A full release of NESmaker 4.5 with complete modules will be out soon.
 

voltopt

Member
I understand, which is why I'm trying to limit my questions. With this tutorial built Summer Camp modules, I am sort of tinkering to learn more about how the code works. My understanding is these self made "modules" will be obsolete when the full release comes out. :)
 

dale_coop

Moderator
Staff member
Exactly.
You could also take a look at how it was working in the 4.1.5 to implement your functionalities in the new version.
For example, in the 4.1.5, when the player dies... the code doesn't reset the game, instead it creates another object (the death animation object), and destroy the player object. Then a end of animation action is set to restart the game.
 

voltopt

Member
Exactly, I set up an object #$08 to handle the animation; I'm thinking the relevant script in 4.1.5 is handleplayerdeath. But simply copying the code over doesn't help, as I'm using a 4.5.2 lives based system instead of a health system. I'll tinker. I can get the death animation to load, but the player remains even if I have the line DeactivateCurrentObject

Also, all player animations are hyper sped up and are not affected by the slider animation speed settings. I'm sure it'll be fine in the future mod!
 

dale_coop

Moderator
Staff member
You need to adapt the code... just keep the logic of what was done in 4.1.5 and redo that with the proper 4.5 operations/macros:
"DeactivateCurrentObject" is now "DestroyObject" in the 4.5
 
Top Bottom