(4.5.9) Please help me create a tile that changes player to action step when all tiles of that type are collected

TolerantX

Active member
Please help me create a tile that changes player to action step when all tiles of that collision type are collected.
Here's the plan.. I want a tile that when it is collected/changes from player colliding with it, it changes to null, then checks for other tiles of the same previous collision type on screen. if there are none, it then changes the player to action step designated Step 7 for the script...
all I could get so far in my file is the following:

Code:
;; What I want this tile to do, check if it is player object. if it is then it continues ;;
;; It is a prize tile that checks for other prize tiles of the same collision type. ;;
;; when all are collected on the screen it changes the player to action step "victory" ;;
;; in that action step the player will do a "victory" dance while invulnerable then warp to next level ;;

CPX player1_object
BEQ +isPlayer
    JMP +notPlayer
    +isPlayer
 
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; BELOW WILL CHANGE TILE AT COLLISION.
 
    ChangeTileAtCollision #$00, #$00
 
    AddValue #$08, myScore, #$5, #$01    ;; this is 50 which is being defined here, 5 digit, in tens place ;;
    UpdateHudElement #$03     ;; this is the HUD element for myScore ;;
 
    +notPlayer
RTS

Also, please don't suggest I create a variable number and fake a check for the tile collisions by using a pre-set number on each screen to do this. I was thinking of this as well, and probably have code for that already. I was hoping for a tile check routine of some sort...

(SOLVED HERE)
View: https://youtu.be/m5QGhErb5sg
 
Last edited:

Pauldalyjr

Active member
I would try something similar to how the monster lock tiles work. You could have it check each tile for type "x". If it finds one it skips executing step 7 and just starts checking tile types again. Once there are no "x" tiles left on the screen then execute step 7.
 

dale_coop

Moderator
Staff member
Hmmm...

You could do like it was implemented in the 4.1?
Use a variable for the prize countr... for example "prizeCounter"

When the tile collision are loaded for your screen (in the oLoadCollisionTable.asm), at the beginning, add:
Code:
    LDA #$00
    STA prizeCounter

And after each "STA tempC" lines in that script (I think twice), add those lines:
Code:
                        CMP #$0B      ;; <-- your prize tile collision HERE
                        BNE +notPrizeTile
                          INC prizeCounter
                        +notPrizeTile:


Finally, in you prize tile script, before the end... add:
Code:
    DEC prizeCounter
    BNE +notAllCollected
        ChangeActionStep player1_object, #$07
    +notAllCollected:

it should do the job.
 

TolerantX

Active member
Hmmm...

You could do like it was implemented in the 4.1?
Use a variable for the prize countr... for example "prizeCounter"

When the tile collision are loaded for your screen (in the oLoadCollisionTable.asm), at the beginning, add:
Code:
    LDA #$00
    STA prizeCounter

And after each "STA tempC" lines in that script (I think twice), add those lines:
Code:
                        CMP #$0B      ;; <-- your prize tile collision HERE
                        BNE +notPrizeTile
                          INC prizeCounter
                        +notPrizeTile:


Finally, in you prize tile script, before the end... add:
Code:
    DEC prizeCounter
    BNE +notAllCollected
        ChangeActionStep player1_object, #$07
    +notAllCollected:

it should do the job.
View: https://youtu.be/G9XNWIveljs
I tried it and made a variable, and simple warp in tile (that i want to replace with a checkpoint that resets the variable to 0 on warp in if needed (I don't know if it does this already... I changed the inputs to all including the hurt player to not recognize the player if they are in action step 6. I think I did everything correct. idk why this is happening...
 

dale_coop

Moderator
Staff member
Maybe your player goes back to another action step... by some script (physics or collision or...)... hmmm.

Try adding:
Code:
        LDA #$FF
        STA gameState
after your "ChangeActionStep player1_object, #$06" in the prize tile script.
 

TolerantX

Active member
Maybe your player goes back to another action step... by some script (physics or collision or...)... hmmm.

Try adding:
Code:
        LDA #$FF
        STA gameState
after your "ChangeActionStep player1_object, #$06" in the prize tile script.
here's a link to all the files and a text file explaining things. :( sorry I couldn't do better.
 

dale_coop

Moderator
Staff member
Check your doLoadCollisionTable script...
you need to add the
Code:
    LDA #$00
    STA prizeCounter

After the "doLoadCollisionTable:" line
(else the code will never be executed)
Maybe it's your error.
 

dale_coop

Moderator
Staff member
When the warp occurs, make sure to set back your player to his action step 0.

In your TimerEndScripts.asm script, search for the goToWarp_action... and after the warp line, add:
Code:
ChangeActionStep player1_object, #$00
 

TolerantX

Active member
When the warp occurs, make sure to set back your player to his action step 0.

In your TimerEndScripts.asm script, search for the goToWarp_action... and after the warp line, add:
Code:
ChangeActionStep player1_object, #$00
Thank You. I've tried multiple times, and this fixed it 100% I will make a video documentation of it working efficiently asap. thank you again sir.
 
Top Bottom