Getting 'unique monster death' to work in Dale's 2-players Simple Platofrm module

Post Reply
User avatar
JFranco
Posts: 16
Joined: Tue Oct 16, 2018 7:30 pm
Location: Ottawa, ON
Contact:

Getting 'unique monster death' to work in Dale's 2-players Simple Platofrm module

Post by JFranco » Sun Mar 29, 2020 12:38 am

So, I've been playing around with Dale's 2-Player Simple Platform module [viewtopic.php?f=35&t=2507&p=15585&hilit ... ion#p15585]

It seems to be working very well for what I need it to do, and Dale is some sort of Assembler 6502 Wizard.

I'm having an issue as I'm trying to incorporate the Unique Deaths for Monsters tweak as pointed out here: nesmakers.com/viewtopic.php?f=60&t=3781&p=20603
In short, I create an Action Step for my Monsters in which when they are KO'd, rather than deactivate, they go to a Death Animation unique to the monster.

It's not working the way I hoped it would, and after tinkering around with for the last few days and trying to solve this problem on my own, I'm out of ideas on how to get it to work. When you KO the monster, yes, it goes to the 8th action state for a millisecond -- but then returns to life as action state 01. You have to kill the monster several times (and it does the same thing -- flip to action state 07 for a millisecond, blink, and then return to action state 00) before it finally disappears for good. I'd love to know what I'm doing wrong and how to fix this.

I'd like, when KO'd with a projectile, for:
-the monster to go to Action State 07
-the Action State 07 animation to play out
-and then the monster be destroyed

Here is my HandleHurtMonster_DC.asm code:

Code: Select all

;;; what should we do with the monster?
        ;;; monster is loaded in x
        LDA Object_vulnerability,x
        AND #%00000100 ;; is it weapon immune?
        BEQ notWeaponImmune
        ;PlaySound #SFX_MISS
        JMP skipHurtingMonsterAndSound
    notWeaponImmune:
        
        LDA Object_status,x
        AND #HURT_STATUS_MASK
        BEQ dontskipHurtingMonster
        JMP skipHurtingMonster
    dontskipHurtingMonster:
        LDA Object_status,x
        ORA #%00000001
        STA Object_status,x
        LDA #HURT_TIMER
        STA Object_timer_0,x
        
        ;;; assume idle is in step 0 - uses idle for hurt state - JF
    
        ChangeObjectState #$00,#$02
        
    ;;;; unfortunately this recoil is backwards
        LDA Object_status,x
        AND #%00000100
        BNE skipRecoilBecauseOnEdge
        LDA Object_vulnerability,x
        AND #%00001000 
        BNE skipRecoilBecauseOnEdge ;; skip recoil because bit is flipped to ignore recoil
        
        LDA selfCenterX
        STA recoil_otherX
        LDA selfCenterY
        STA recoil_otherY
        LDA otherCenterX
        STA recoil_selfX
        LDA otherCenterY
        STA recoil_selfY
        JSR DetermineRecoilDirection
    skipRecoilBecauseOnEdge:
        LDA Object_health,x
        SEC
        SBC #$01
        CMP #$01
        BCC +
        JMP notMonsterDeath
    +

       LDA Object_x_hi,x
       STA temp
       LDA Object_y_hi,x
       STA temp1

        
       
        ChangeObjectState #$07,#$01 ;;; step 07 is destroyed monster  -JF
             

        
        ;;; DC suggestion - uncomment this and the monster is no longer a monster
        ;LDA Object_flags,x
        ;AND #%11110111  ;; remove the "monster" flag of the object
        ;STA Object_flags,x
        
        ;;; destroy monster after killing - JF
		

		
        ;DeactivateCurrentObject
    
        
        
        


    PlaySound #SND_MONSTER_DEATH
        ;;;;;;;;;;;;;;;;;; ok, so now we also add points to score
        ;LDY Object_type,x
        ;LDA ObjectWorth,y
        ;STA temp
;       AddValue #$03, GLOBAL_Player1_Score, temp
                ;arg0 = how many places this value has.
                ;arg1 = home variable
                ;arg2 = amount to add ... places?
        ;; and this should trip the update hud flag?
        
        ;;;; 
    

    TXA
    STA tempy   ;;dale_coop

    ;AddValue #$08, myScore, #$01, #$00
    ;STA hudElementTilesToLoad
    ;UpdateHud HUD_myScore
    LDX tempy   ;;dale_coop

        JSR HandleDrops
        
        ;;JSR HandleToggleScrolling ;; dale_coop removed handle scroll
        
        CountObjects #%00001000, #$00
        LDA monsterCounter
        CLC ;;dale_coop
        BEQ +
        JMP ++
    +
        .include SCR_KILLED_LAST_MONSTER
    ++
        JMP skipHurtingMonster
    notMonsterDeath:
        STA Object_health,x
        PlaySound #SND_MONSTER_HURT
    skipHurtingMonster: 
        ;;PlaySound #SND_MONSTER_HURT
    
    skipHurtingMonsterAndSound:
        LDX tempx
        LDA Object_type,x
        ;; we don't destroy the melee object
        CMP #OBJECT_PLAYER_MELEE
        BEQ +
        ;; what should we do with the projectile?
        DeactivateCurrentObject ;; destroy it ?
        +



Thanks to anyone who can help!

Sincerely,
Justin
User avatar
dale_coop
Posts: 5215
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Getting 'unique monster death' to work in Dale's 2-players Simple Platofrm module

Post by dale_coop » Sun Mar 29, 2020 1:57 pm

I you want tomato them KO, and stay like this... (technically it's exactly like death, just playing a KO/Death animation that would not be destroyed)
You could use the Monsters Death Animation object for that... where the normal behavior Action Step 0 is to play the normal death animation and destroyMe. And for your specific monsters, you could play the Action Step 1 (a KO animation) with no destroyMe...?

For that, just modify the Handle Monster Drops script..
At the end you will see the creation of the normal Monster Death Animation object (action step 00):

Code: Select all

donePickup:	
	;;; ALL cases create a "pow"
	CreateObject temp, temp1, #OBJ_MONSTER_DEATH, #$00, temp3
Add a check for which monster it is... and if it's your monster (for example, object #19), the monster death animation with action step 1:

Code: Select all

donePickup:	
	;;; ALL cases create a "pow"
	;; check which monster?
	LDX tempy
	LDA Object_type,x
	;; if it is the ID #19
	CMP #19
	BNE +	
		;; create special Death Animation object (KO animation, action step 1): 
		CreateObject temp, temp1, #OBJ_MONSTER_DEATH, #$01, temp3
		JMP ++
	+
		;; else, we still play the normal death animation (action step 0):
		CreateObject temp, temp1, #OBJ_MONSTER_DEATH, #$00, temp3
	++
	; ;end
	
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
My son's game: KUBO 3
Post Reply