[4.5.6] Arcade Platformer module - How to get Pickup respawn

Pep31

New member
Hi everybody,

I'm looking for the best way to get a power-up respawn a certain amount of time after the player picked it up. Do I have to deal with the action steps of the object to achieve that ?

Any hint would be welcome.

Thanks !
 

dale_coop

Moderator
Staff member
Exactly, you could use an action step for that.
When you collect your pickup, instead of destroy it, change its action step (let's say 7...), for that specific action step use a empty graphics animation and at the end of a timer (timer value) do "GoToFirst".
Also, in the pickup script, you could check your pickup current action step... if already invisible, then you skip the code.
 

Pep31

New member
I managed to change the action step of my pickup. It disappears correctly on collision and re-spawn a while after. But I'm struggling on the pickup script to check the pickup current action step.
Here is my pickup script (the interresting item is the #$05). Can you see what's wrong with it ?

Code:
    TXA
    STA temp

    LDA Object_type,x
    CMP #$05 ;;What object is your pickup?  00 - 0f
    BNE +notThisPickup
        GetActionStep temp
        CMP #$07 ;; is it invisible ?
        BEQ +endPickups
            LDA #$00
            STA dashCounter
            UpdateHudElement #$01
            JMP +endPickups
+notThisPickup:

    CMP #$04
    BNE +notThisPickup
            INC myLives
            UpdateHudElement #$03
            JMP +endPickups
 +notThisPickup:

+endPickups

With that script, the dashCounter variable is never increased whether the step is #$00 or #$07.
 

Pep31

New member
Ok. The problem was that my pickup's ActionStep was changed before the pickup script ran. So his ActionStep was always $07 when he went through the pickup script.

To make it works, I had to run the pickup script before changing the ActionStep (modification is in doHandleOjectCollisions.asm) :

Code:
;; There was a collision between a player and a powerup.
;; player is self.
;; powerup is other.
;DestroyObject
LDX otherObject
LDA Object_type,x
CMP #$05
BNE +notAdashPickup
    .include SCR_PICKUP_SCRIPTS
    ChangeActionStep otherObject, #$07
    JMP +skip
+notAdashPickup
    DestroyObject
    .include SCR_PICKUP_SCRIPTS
+skip
JMP +done
 
Top Bottom