[4.5] Reset player in same screen when killed. Reset to beginning when lives run out?

offparkway

New member
Would like my player to either show a hurt animation or reset in the same screen when hit by an enemy, and only reset to beginning when lives get to 0.
 

dale_coop

Moderator
Staff member
Yeah, if you followed all the tutorial videos...
now, just make checkpoint type tiles (checkpoint.asm), your player touches the checkpoint, he will respawn from that place after dying...
Here's the code:

Code:
;; chekpoint tile

LDA Object_x_hi,x
STA continueX
LDA Object_y_hi,x
STA continueY
LDA warpMap
STA continueMap
LDA currentNametable
STA continueScreen

Assign to a new tile type (like Joe explained to do with the "spikes" tiles, for example).
And place it at the beginning of your screen (level), usually at the same spot where your player is warped in (spawn)..
 

offparkway

New member
are there specific limits to this code? It works great for some screens, but all of a sudden when I use the checkpoint tile on another screen, it stops responding and resets me to a much earlier checkpoint.

For instance the first time I used the checkpoint tile, it worked great. Right now I'm trying to use it on a later game screen, and the game totally ignores it.

I can't figure out why it works sometimes, and why it doesn't work other times.
 

offparkway

New member
are there specific limits to this code (can I use the tile anywhere?) It works great for some screens, but all of a sudden when I use the checkpoint tile on another screen, it stops responding and resets me to a much earlier checkpoint, or resets me to the spot where I placed my player.

For instance the first time I used the checkpoint tile, it worked great. Right now I'm trying to use it on a later game screen, and the game totally ignores it.

I can't figure out why it works sometimes, and why it doesn't work other times.

dale_coop said:
Yeah, if you followed all the tutorial videos...
now, just make checkpoint type tiles (checkpoint.asm), your player touches the checkpoint, he will respawn from that place after dying...
Here's the code:

Code:
;; chekpoint tile

LDA Object_x_hi,x
STA continueX
LDA Object_y_hi,x
STA continueY
LDA warpMap
STA continueMap
LDA currentNametable
STA continueScreen

Assign to a new tile type (like Joe explained to do with the "spikes" tiles, for example).
And place it at the beginning of your screen (level), usually at the same spot where your player is warped in (spawn)..
 

dale_coop

Moderator
Staff member
The engine changes like in every tutorial video...Joe changes the scripts, new patches, new engine..
Maybe it doesn't work anymore because the engine changes.
I am pretty sure it will not work with the scrolling module (except the first screen of the scrolling section maybe).

It's the reason I suggest to wait (and it's what I am doing) the end of this Summer Camp... and that the definitive modules are released before making custom scripts. Because as the engine always changes... a script that would work one day with the current engine might not work the next week because the engine evolved.

PS: I still haven't watched the last tutorial videos... I am so late ;)
 

offparkway

New member
I understand. I know the definitive modules will come, but in the mean time he's encouraging us to tinker around and try things. Just want to make sure I'm on the right path!
 

dale_coop

Moderator
Staff member
Totally, you're encouraged to do experiments...
But as he said, there are bugs, don't become mad or lose your mind on them... the engine might be different in the final version and all those will be different. So, just have fun and play.
You're on the right path, if you follow what he did and have the same results

(What I do: I have 2 newsmaker folders/projects one that is exactly like the tutorials... and another one with my experiments, different gfx, custom small scripts,...)
 

offparkway

New member
Yeah I've been doing the same thing. I'm going off and messing with a whole different copy than the one we're learning with. I kinda realized what was going on with the checkpoint tile... it doesn't like being next to a screen edge or a solid tile. If I place the checkpoint tile in a spot that is surrounded by null-walkable tiles, it seems to work just fine.
 
Top Bottom