4.5.9 PLEASE HELP WITH INPUT SCRIPT RELEASE DESTROY PLAYER WEAPON

NightMusic

Member
Please help me. I'm having trouble. I made a change attack to stop script but I want to destroy the weapon as well.
I created a melee weapon in object #$01
i made it purposely not destroy and stay on screen
I want to destroy it when the player releases the attack button
below I have inserted my script.. It currently returns the player to their idle when i release B button...
I didnt add the destroy object for the player melee (object #$01) because i forgot how to call it to the accumulator or something to destroy it.
Please and Thank you for helping me.

Code:
   TXA
    STA temp ;; assumes the object we want to move is in x.
    GetActionStep temp
    CMP #$05                ;; Attack Action;;
    BEQ +isAttacking
        RTS
    +isAttacking
        ChangeActionStep temp, #$00 ;; assumes that "walk" is in action 1
        ;arg0 = what object?
        ;arg1 = what behavior?

  
    RTS
 

dale_coop

Moderator
Staff member
To destroy the object 01, here's the code:
Code:
    TXA
    PHA
    LDX #$00
    -loopForWeapon:
        LDA Object_status,x
        AND #%10000000
        BEQ +nextObj
            LDA Object_type,x
            CMP #$01 ;; the weapon to destroy
            BNE +nextObj
                ;; it is that weapon object, then:
                DestroyObject
        +nextObj:
        INX
        CPX #TOTAL_MAX_OBJECTS
        BNE -loopForWeapon
    PLA
    TAX
 

NightMusic

Member
To destroy the object 01, here's the code:
Code:
    TXA
    PHA
    LDX #$00
    -loopForWeapon:
        LDA Object_status,x
        AND #%10000000
        BEQ +nextObj
            LDA Object_type,x
            CMP #$01 ;; the weapon to destroy
            BNE +nextObj
                ;; it is that weapon object, then:
                DestroyObject
        +nextObj:
        INX
        CPX #TOTAL_MAX_OBJECTS
        BNE -loopForWeapon
    PLA
    TAX
Thanks this indeed worked!
 

NightMusic

Member
To destroy the object 01, here's the code:
Code:
    TXA
    PHA
    LDX #$00
    -loopForWeapon:
        LDA Object_status,x
        AND #%10000000
        BEQ +nextObj
            LDA Object_type,x
            CMP #$01 ;; the weapon to destroy
            BNE +nextObj
                ;; it is that weapon object, then:
                DestroyObject
        +nextObj:
        INX
        CPX #TOTAL_MAX_OBJECTS
        BNE -loopForWeapon
    PLA
    TAX
It destroys but not if i tap the button fast.. like rapid taps make it stick around until its tapped again. I'll make a game topic and tag you in a video of it. <3 merci
 
Top Bottom