RustyRetroEntertainmentSy
Member
Hi, giving back to the community.
This is simple stuff for the moast of you. But it took a while for me to figure this out. So im posting this for other beginners.
I wanted some of my larger monsters to shrink to a smaller monster when beeing hit.
Kind of how Super Mario gets small when he gets hurt. But for the monsters.
Step 1:
I changed my hurtMonster_PlatformBase.asm using the thread: https://www.nesmakers.com/index.php?threads/monster-death-animation.7614/
so that the monster doesen't get destroyed and moves to it´s actionstep7 instead.
Also needed to edit hurtPlayer_Platformbase.asm
Look for this piece of code
LDX otherObject
(around row 26?, my script has been alterd before)
Step2: Setting up monsters actionstep7
Add a DestroyMe script to a unused AI_Behavior in your ProjectSettings / Script settings (i used nr 6)
only code needed in the .asm file is:
Add the SpawnMonster script to another AI_Behavior that is unused. (i used nr 5)
I´m using Yans invincibility timer from this thread https://www.nesmakers.com/index.php...layer-to-move-during-hurt-invincibility.6522/
Otherwise i am taking a hit everytime the monster spawns. You can probably solve this in other ways, but this works fine for me.
(it´s the top 4 rows of code if you want to remove it.)
Go to your ProjectSettings, Labels, click on actiontypes and rename your AI_behaviors to spawnMonster (i used nr5) and DestroyMe (i used nr6) to keep things organized)
- Monsters that should get destroyed as usual: set their actionstep 7´s action to DestroyMe
-Monsters that should spawn a smaller or another monster when dying set their actionstep7´s action to spawnMonster
You will need to have both of the monsters loaded in the screens selected monstergroup to be able to use them on your level in the game.
Done.
Works for me.
This is the first tutorial i´v shared, so i hope i haven't done anyting stupid
And there is probably a simpler way of doing this...
Always keep a safety copy of your files before you edit or replace any of your scripts.
This is simple stuff for the moast of you. But it took a while for me to figure this out. So im posting this for other beginners.
I wanted some of my larger monsters to shrink to a smaller monster when beeing hit.
Kind of how Super Mario gets small when he gets hurt. But for the monsters.
Step 1:
I changed my hurtMonster_PlatformBase.asm using the thread: https://www.nesmakers.com/index.php?threads/monster-death-animation.7614/
so that the monster doesen't get destroyed and moves to it´s actionstep7 instead.
TXA STA temp GetActionStep temp CMP #$07 ;; we will use action step 7 for hurt. BEQ +doSkipHurtingThisObject ;; if he is hurt, he can't be hurt again. ChangeActionStep temp, #$07 LDA #$80 STA Object_action_timer,x DEC Object_health,x LDA Object_health,x BNE +doSkipHurtingThisObject ; DestroyObject ;;Dont want the object to be destroyd any more, only moved to actionstep 7 ;;thats where we set up the destroyMe or spawn small monster. CountObjects #%00001000 BNE +notZeroCount LDA scrollByte ORA #%00000010 STA scrollByte ;;; if there are no more monsters left, we want to disable ;;; the edge check for scrolling. LDA ScreenFlags00 AND #%11101111 STA ScreenFlags00 +notZeroCount +doSkipHurtingThisObject |
Also needed to edit hurtPlayer_Platformbase.asm
Look for this piece of code
LDX otherObject
(around row 26?, my script has been alterd before)
LDX otherObject ;; Destroy Object ;;dont want to do that any more ChangeActionStep otherObject, #$07 ;;when hurt monster goes to actionstep7 instead |
Step2: Setting up monsters actionstep7
Add a DestroyMe script to a unused AI_Behavior in your ProjectSettings / Script settings (i used nr 6)
only code needed in the .asm file is:
DestroyObject |
Add the SpawnMonster script to another AI_Behavior that is unused. (i used nr 5)
;; SPAWN A MONSTER LDA #$10 ;<---How long to stay invinciable, change the number as you see fit STA invincibilityTimer ;;Used so monster does not spawn at player and hurt him TXA PHA LDA Object_x_hi,x STA temp1 LDA Object_y_hi,x STA temp2 LDA Object_screen,x ;; the current screen STA temp3 DestroyObject CreateObjectOnScreen temp1, temp2, #16, #$00, temp3 ;;;<-- #16 the 16th gameobject, or first monsterobject, my small Monster ;; arg0 = x ;; arg1 = y ;; arg2 = object ;; arg3 = beginning state ;; arg4 = what screen do youw ant to create this object on? CountObjects #%00001000 BNE +notZeroCount LDA scrollByte ORA #%00000010 STA scrollByte ;;;if there are no more monster left, we want to disable ;;; the edge check for scrolling ;LDA screenflag00 AND #%11101111 ;STA screenflag00 +notZeroCount: PLA TAX |
I´m using Yans invincibility timer from this thread https://www.nesmakers.com/index.php...layer-to-move-during-hurt-invincibility.6522/
Otherwise i am taking a hit everytime the monster spawns. You can probably solve this in other ways, but this works fine for me.
(it´s the top 4 rows of code if you want to remove it.)
Go to your ProjectSettings, Labels, click on actiontypes and rename your AI_behaviors to spawnMonster (i used nr5) and DestroyMe (i used nr6) to keep things organized)
- Monsters that should get destroyed as usual: set their actionstep 7´s action to DestroyMe
-Monsters that should spawn a smaller or another monster when dying set their actionstep7´s action to spawnMonster
You will need to have both of the monsters loaded in the screens selected monstergroup to be able to use them on your level in the game.
Done.
Works for me.
This is the first tutorial i´v shared, so i hope i haven't done anyting stupid
And there is probably a simpler way of doing this...
Always keep a safety copy of your files before you edit or replace any of your scripts.