Secret Box

Post Reply
User avatar
Posts: 135
Joined: Wed Apr 18, 2018 1:59 pm

Secret Box

Post by dark_crow_66 » Wed Oct 24, 2018 3:36 am

Can anyone help with coding a secret box kind of like the first invisible one up box in Super Mario Bros 1-1, but not giving a prize (although that be cool for a secret box too)? I want an invisible box that ignores player from top, left, and right, but changes to same block as an activated Prize Box Tile when hit from bottom. I was thinking of using the One way Platform code and Prize box code to create a Secret Box Code, but found out the codes are not in the "OneWayPlatform.asm" or "PrizeBox.asm" in the tile script folder. Now the codes that handle the tile types are in "Physics_Platform_Simple.asm" I don't even know where to start with this new set up.

I think i found where in the Physics_Platform_Simple code I have to make my additions to the code. Hope to get this working.
User avatar
Posts: 108
Joined: Fri Jan 18, 2019 7:58 am

Re: Secret Box

Post by TolerantX » Thu Jan 09, 2020 4:00 pm

Prize Block.asm is a file you have? Okay with that assigned to a tile in Project Settings > Script Settings
If you're using Dale Coop's 2 player core/modules this is included and also in his defined Project Settings > User Constants


Dale helped me in this thread here:

Look in MODULE SCRIPTS > MAIN SCRIPTS > in the file named TileCollision_4_1_0.asm (if using dale's it's TileCollision_4_1_0_DC.asm)
Take a look at the END of the code.... near the end should be all your prize block information for collisions.
All of this handles the block itself collision which should be set in your User Constants (discussed above)

You want to make sure it will be solid when you're done. (*if the COL_INDEX_PRIZE_BLOCK_OFF set to 1 isn't working to make it solid)

make these changes...

the current line:
ChangeTileAtCollision #$00, #TILE_INDEX_PRIZE_OFF

change it to:
ChangeTileAtCollision #$01, #TILE_INDEX_PRIZE_OFF

IF you want both as in PRIZE BOXES THAT ARE SOLID as in MARIO and PRIZE BOXES that are invisible and walkable air before triggered you need 2 different tiles also you'd need to set the variables above and basically that last half of code duplicated and more changes I don't know currently to make BOTH happen.

Placement of Powerup/Drop:
after the prize is triggered if you don't like where your power up shows up and/or it is rocketing to the sky...
1. Make sure the object/powerup has accelleration set to a number Dale recommended 255 the max, unless you need something else.
(*this prevents rocketing effect)
2. if you want it more centered and a bit higher...
look for the line: (from earlier) (below it is the code you need to make it position change)
ChangeTileAtCollision #$01, #TILE_INDEX_PRIZE_OFF

LDA Object_x_hi,x
ADC #$02 ;this moves the powerup spawn position right a bit;;
STA temp
LDA Object_y_hi,x
SBC #$16 ;; a bit more than the height of it.
STA temp1

(*etc... but that's the part we needed to alter.)
(Thanks to Dale Coop, Kevin Skeen, and Patricio Pereira who all have taught me some assembly.)
Post Reply