Why is making a second Solid Tile impossible?

Bucket Mouse

Active member
I'm trying to make a platform tile in the Arcade Platformer module that will hurt you under certain conditions, but if other conditions are met you can stand on it.
This is the Solid Tile script:

Code:
    LDA ObjectUpdateByte

    ORA #%00000001

    STA ObjectUpdateByte ;; makes solid

    RTS

It stands to reason that if I dupe this script at the beginning of playerHurt_ArcadePlatformerBase and add the conditions, it should be solid under those conditions. Like this:

Code:
LDA flagUp
    CMP #$01
    BNE flagIsNotUp

    LDA ObjectUpdateByte
    ORA #%00000001
    STA ObjectUpdateByte ;; makes solid
    RTS
  flagIsNotUp:

But instead, the player falls through the tile. I don't understand why!
The weird thing is that you fall through the tile, but you can't move horizontally while you're in there, as if it remembers "oh yeah, the tile is solid." But you can still jump out.

But that['s not as weird as this: I replaced the tile with a second Solid Tile and got the same result.No alterations -- just a second Solid Tile using the same script.

Why can't I use the Solid Tile script for two different scripts? I asked on the Discord and was told the Solid title isn't actually programmed in the tile code itself -- it's in doHandleTileCollisions_ArcadePlatformBase.asm. So I found the part that was looking for tile #1, and altered it so it would look for tile #2 as well:

Code:
        LDA tempA
    BEQ +skipThisTile
    CMP #$01
    BNE +isNotSolid
        JMP +isSolid
    +isNotSolid
    CMP #$02
    BNE +isNotSolid
        JMP +isSolid
    +isNotSolid
    +skipThisTile
    LDA tempB
    BNE +dontSkipThisTile
        JMP +skipThisTile
    +dontSkipThisTile:
    CMP #$01
    BNE +isNotSolid
        JMP +isSolid
    +isNotSolid
    CMP #$02
    BNE +isNotSolid
        JMP +isSolid
    +isNotSolid
    +skipThisTile
    LDA tempC
    BEQ +skipThisTile
    CMP #$01
    BNE +isNotSolid
        JMP +isSolid
    +isNotSolid
    CMP #$02
    BNE +isNotSolid
        JMP +isSolid
    +isNotSolid
    +skipThisTile
    LDA tempD
    BEQ +skipThisTile
    CMP #$01
    BNE +isNotSolid
        JMP +isSolid
    +isNotSolid
    CMP #$02
    BNE +isNotSolid
        JMP +isSolid
    +isNotSolid
    +skipThisTile

It doesn't work. In fact, the tile no longer hurts you in either state. I don't get it! Does anyone know what to do?
 

Jonny

Well-known member
Have you looked at the bounds checks in your physics script? That's the only reason I could think of that might cause that.
If you watch advanced tutorial for metrovania where Joe makes a triggered wall thing, he explains something similar about top bounds not being observed.
 

dale_coop

Moderator
Staff member
Also, for solid ground tiles (where your player will stand on) I think you need to do the same kind of modification in the Handle Physic script too.
 

Bucket Mouse

Active member
You were right about Handle Physics -- there was a check there. I had to alter three scripts -- Handle Physics, Handle Tile Collisions, and the Jump input -- by adding the same portion in the part that checks for types of collision:

Code:
        CMP #$02 ;; the hurt tile
        BNE +isNotSolid
        TAY ;;;we temporarily need A for something else
        LDA flagUp ;; use A to check for flag
        CMP #$01
        BNE +isNotSolid ;; if flag is not on, move on
        TYA
        JMP +isSolid ;; if flag is on, block is solid
        +isNotSolid
        TYA

I bet I could just use Y instead of temporarily juggling the current A into Y, but....it works and I'm done.
 
Last edited:

Bucket Mouse

Active member
The above script has to be repeated in Handle Tile Collisions four times, for all four points. I thought it would make sense to just create a subroutine and direct to that. The sub worked for points A and B, but screwed up on points C and D. That makes no sense. IT'S THE SAME SCRIPT

And possibly for a related reason, I can't "just use Y" on C and D. I have no idea what that reason is.
 

BroTheRetro

New member
I was doing something similar. I have the same problem and I think it's because we can't put a lot of code in between. If you had a lot of code, that means you had instructions in the memory and it gets full. So we need to be creative to manage that xD I still didn't figure this out
 

vanderblade

Active member
You were right about Handle Physics -- there was a check there. I had to alter three scripts -- Handle Physics, Handle Tile Collisions, and the Jump input -- by adding the same portion in the part that checks for types of collision:

Code:
        CMP #$02 ;; the hurt tile
        BNE +isNotSolid
        TAY ;;;we temporarily need A for something else
        LDA flagUp ;; use A to check for flag
        CMP #$01
        BNE +isNotSolid ;; if flag is not on, move on
        TYA
        JMP +isSolid ;; if flag is on, block is solid
        +isNotSolid
        TYA

I bet I could just use Y instead of temporarily juggling the current A into Y, but....it works and I'm done.
Can you explain again how you went about this? I have a breakable block that is solid from the left, right, and top, but not the bottom, and it's bugging me to no end. I changed the doHandleTileCollisions in the same way as you did above, but I guess I'm missing the other parts?
 

mouse spirit

Well-known member
Im in 4.1.5, but i make other solid tiles.
One is normal solid, the other is normal solid BUT also i can drillkick it and break it. But in 4.1.5, solid code looks like this instead......

LDA #TILE_SOLID
STA tile_solidity
RTS
 

vanderblade

Active member
Im in 4.1.5, but i make other solid tiles.
One is normal solid, the other is normal solid BUT also i can drillkick it and break it. But in 4.1.5, solid code looks like this instead......

LDA #TILE_SOLID
STA tile_solidity
RTS
For sure. I have no issues in 4.1.5. But 4.5.x works differently.
 

Bucket Mouse

Active member
Can you explain again how you went about this? I have a breakable block that is solid from the left, right, and top, but not the bottom, and it's bugging me to no end. I changed the doHandleTileCollisions in the same way as you did above, but I guess I'm missing the other parts?
Thing is, for my game I didn't need the tile to be different conditions on the bottom, just the top. if it doesn't work there, that was a blind spot for me -- I never looked into getting it to work on the bottom. It was for hurt tiles, not breakable tiles.

The code is pasted in twice on doHandlePhysics_ArcadePlatformBase, directly under this part:

GetCollisionPoint temp, temp1, tempA ;; is it a solid?
CMP #$01
BNE +isNotSolid
JMP +isSolid
+isNotSolid

The second occurrence is shortly below that, under a bit of script that is identical except temp3 is being examined instead of temp.
Also, the "juggle Y" part is dummied out in the version I have here:

Code:
        CMP #$02 ;; the hurt tile
        BNE +isNotSolid
 ;;       TAY ;;;we temporarily need A for something else
        LDA flagUp ;; use A to check for flag
        CMP #$01
        BNE +isNotSolid ;; if flag is not on, move on
 ;;       TYA
        JMP +isSolid ;; if flag is on, block is solid
        +isNotSolid
   ;;     TYA

Also, I ended up not having to alter doHandleTileCollisions or the jump input at all -- just doHandlePhysics, in those two places.

I haven't attempted to do what you're doing. It's possible you DO need doHandleTileCollisioins for something like breakable blocks because it examines all four coordinates.
In the event that turns out to be true, I still have my unused script and I placed the above code in the four places under "gotPoint3" where each temp number is examined. They all have this directly before my portion:

CMP #$01
BNE +isNotSolid
JMP +isSolid
+isNotSolid
 

vanderblade

Active member
I'll look into it some more. Thanks! Yet again an issue that wasn't present in the former NESMaker that is proving inscrutable, for me, in this version.

Edit: To be clear, my breakable block code works just fine. The issue is that the block, pre-break, is only solid on three sides. Again, not game-breaking necessarily, but definitely not ideal and it reads as a mistake to players.
 
Last edited:

vanderblade

Active member
Update. I ended up just piggybacking off of the "prize tile" hardcoded into Tile09. I then just edited the Solid reaction code to get rid of the prize part of it. Bingo. A fully solid on-four-sides tile that can still "break" when shot at with a player projectile.
 
Top Bottom