Bucket Mouse
Active member
As it is, the big recoil when the player touches an enemy is a cheap method of avoiding repeated damage -- and it doesn't work in every situation; if the recoil pins you against a wall the monster can just poke at you over and over until you're dead.
What we need is two Action Steps: the recoil and a period of invincibility afterward. To do this we must move Hurt to Action Step 06 so the other part can be 07. Setting up the invincibility is pretty simple, since the player is ALSO invincible during the recoil and it is just a skip of the Player Hurt code:
You can just duplicate that for #$06 and have it work in both Action Steps. Then, upon the suggestion of AllDarnDavey below, you alter Action States 6 and 7 of your player character as follows:
Note how the recoil time here is much lower than what Joe sets it at in the tutorial. It's no longer necessary to fling your character clear across the screen if you have a little extra time to move out of the way, and it's also annoying.
Make the invincibility time a bit longer than the recoil....just enough time to get out of the way. Note that your Hurt animation should be of the player flashing, if it's not already.
Now to make it so Step 6 makes you invincible. The following scripts must be altered a bit:
PlayerHurt_Health
doHandleObjectCollisions_AdventureBase2 (the module I'm using...it is present in the other variations of this script as well)
stopMoving
Bank18_AdventureBase
I changed all of these to read both action state 06 and 07 as invincibility states. PlayerHurtHealth should look like this near the beginning:
What to change in doHandleObjectCollisions_AdventureBase2:
The entirety of the altered StopMoving:
And what to do in Bank18:
You get the idea -- you just duplicate the code each time.
Now you stand a fighting chance out there in the dungeons you create.
What we need is two Action Steps: the recoil and a period of invincibility afterward. To do this we must move Hurt to Action Step 06 so the other part can be 07. Setting up the invincibility is pretty simple, since the player is ALSO invincible during the recoil and it is just a skip of the Player Hurt code:
Code:
CMP #$07
BNE +canHurtPlayer
JMP +skipHurt
+canHurtPlayer
You can just duplicate that for #$06 and have it work in both Action Steps. Then, upon the suggestion of AllDarnDavey below, you alter Action States 6 and 7 of your player character as follows:
Note how the recoil time here is much lower than what Joe sets it at in the tutorial. It's no longer necessary to fling your character clear across the screen if you have a little extra time to move out of the way, and it's also annoying.
Make the invincibility time a bit longer than the recoil....just enough time to get out of the way. Note that your Hurt animation should be of the player flashing, if it's not already.
Now to make it so Step 6 makes you invincible. The following scripts must be altered a bit:
PlayerHurt_Health
doHandleObjectCollisions_AdventureBase2 (the module I'm using...it is present in the other variations of this script as well)
stopMoving
Bank18_AdventureBase
I changed all of these to read both action state 06 and 07 as invincibility states. PlayerHurtHealth should look like this near the beginning:
Code:
GetActionStep temp
CMP #$06
BNE +canHurtPlayer
JMP +skipHurt
+canHurtPlayer
CMP #$07
BNE +canHurtPlayer2
JMP +skipHurt
+canHurtPlayer2
What to change in doHandleObjectCollisions_AdventureBase2:
Code:
GetActionStep temp
CMP #$06
BNE +notHurt1
JMP +skipObjectCollisionCheck
+notHurt1
CMP #$07
BNE +notHurt2
JMP +skipObjectCollisionCheck
+notHurt2
The entirety of the altered StopMoving:
Code:
;;;;
TXA
STA temp ;; assumes the object we want to move is in x.
GetActionStep temp
CMP #$07
BNE +notHurt
RTS
+notHurt
CMP #$06
BNE +notHurt2
RTS
+notHurt2
StopMoving temp, #$FF, #$00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RTS
And what to do in Bank18:
Code:
GetActionStep tempz
CMP #$06
BNE +notHurtState
LDA ObjectUpdateByte
ORA #%00000001 ;; is it solid?
STA ObjectUpdateByte
JMP ObjectDoesNotObserveTiles
+notHurtState
CMP #$07
BNE +notHurtState2
LDA ObjectUpdateByte
ORA #%00000001 ;; is it solid?
STA ObjectUpdateByte
JMP ObjectDoesNotObserveTiles
+notHurtState2
You get the idea -- you just duplicate the code each time.
Now you stand a fighting chance out there in the dungeons you create.