my hurt tile

FrankenGraphics

New member
a simple addition, if you need one. detracts one life for player.

step 1:
-go to the handlePlayerHurt.asm your project is using. be aware that there may several copies named the same for different modules.

add this to the very top of the document
Code:
hurtPlayer:

save.

step 2:
make a new text document.
paste the following
Code:
cpx player1_object 
bne +
lda Object_timer_0,x
bne +
jsr hurtPlayer
+

save as myHurtTile.asm or whatever you'd like it to be named in an appropriate place.

Link up the new .asm file in script settings to a tile ID you want it to be.

Hurt tile properties:
-only hurts player
-player will recoil
-only detracts one life per hit/recoil period (checking object_timer_0,x guarantees this every time).
 

WillElm

New member
Thanks for this. I was trying to think of ways to do exactly this the other day. Of course I was over complicating it, this is nice and simple.
 

SpiderDave

New member
You don't need to make a new label, and you're bypassing things like being lethal invincible. Here's what I use for spikes (I want them to hurt not kill).

spikes.asm
Code:
    CPX player1_object
    BNE +

    lda #$01
    sta disableRecoil

    JSR doPlayerHurt
+
    LDA #TILE_SOLID
    STA tile_solidity

Set it up for one of your tile collision scripts. The last bit of code makes it solid.

In HandlePlayerHurt.asm, I added a check to disable recoil if "disableRecoil" is set.
You'll need to add the variable "disableRecoil". What it does is a one-time disable of recoil.

look for the line with:
Code:
    JSR DetermineRecoilDirection

and change it to this:
Code:
    lda disableRecoil
    bne +
    JSR DetermineRecoilDirection
+
    ; Turn it off automatically afterwards
    lda #$00
    sta disableRecoil
 
Top Bottom