[4.5.9] Dynamic Moving Platforms that carry the player any direction

Checking my physics script and I also added this to the bottom at doneWithGravity:

Code:
;;;; ADDING

doneWithGravity:

VerticalMovement:
    LDA Object_direction,x
    AND #%00100000
    BEQ +noVertMovement
        ;; there is vertical movement
        LDA Object_direction,x
        AND #%00010000
        BEQ +isUpMovement
            ;; is down movement
            LDA Object_y_lo,x
            CLC
            ADC myMaxSpeed;Object_v_speed_lo,x
            STA yHold_lo
            LDA Object_y_hi,x
            ADC myMaxSpeed+1;Object_v_speed_hi,x
            STA yHold_hi
                CLC
                ADC self_bottom
                CMP #BOUNDS_BOTTOM ;#240
        
                BCS doBottomBounds
                    JMP +noVertMovement
                doBottomBounds:
                    CPX player1_object
                    BEQ +isPlayer
                        DestroyObject
                        JMP skipPhysics
                    +isPlayer
                        LDA yPrev
                        STA yHold_hi
                        STA Object_y_hi,x
                        ; LDA #$00
                        ; STA Object_v_speed_hi,x
                        ; STA Object_v_speed_lo,x
                        ; LDA #$00
                        ; STA screenUpdateByte
                        ; JSR doHandleBounds
                        JMP skipPhysics
        +isUpMovement
            LDA Object_y_lo,x
            SEC
            SBC myMaxSpeed;Object_v_speed_lo,x
            STA yHold_lo
            LDA Object_y_hi,x
            SBC myMaxSpeed+1;Object_v_speed_hi,x
            BCC +doTopBounds ;; helps if top bounds is zero.
            STA yHold_hi
            CMP #BOUNDS_TOP
                BEQ +doTopBounds
                BCC +doTopBounds
                    JMP +noVertMovement
                +doTopBounds
                    CPX player1_object
                    BEQ +isPlayer
                        DestroyObject
                        JMP skipPhysics
                    +isPlayer
                    
                        LDA yPrev
                        STA yHold_hi
                        STA Object_y_hi,x
                        ; LDA #$00
                        ; STA Object_v_speed_hi,x
                        ; STA Object_v_speed_lo,x
                        ; LDA #$02
                        ; STA screenUpdateByte
                        ; JSR doHandleBounds
                        JMP skipPhysics
    +noVertMovement
 
 

skipPhysics:
I did everything you showed me. My vertical platform still remain motionless. No moves at all. You did something else.
 

kbogle

Member
I did everything you showed me. My vertical platform still remain motionless. No moves at all. You did something else.
You have the platform set to ignore gravity right? I'll keep checking. You want my full physics script so you can compare?
 

kbogle

Member
I did everything you showed me. My vertical platform still remain motionless. No moves at all. You did something else.
This is the Physics script I'm using. it's heavily modified for my game. I am trying to think what else I've done that would have made it work for me. Double check your action steps for the platform.
 

Attachments

  • doHandlePhysics_PlatformBase_SeamFix.zip
    4.8 KB · Views: 3
  • Screenshot 2024-11-25 190354.png
    Screenshot 2024-11-25 190354.png
    36.1 KB · Views: 4
  • Screenshot 2024-11-25 190729.png
    Screenshot 2024-11-25 190729.png
    31.1 KB · Views: 4
  • Screenshot 2024-11-25 190800.png
    Screenshot 2024-11-25 190800.png
    31 KB · Views: 4
This is the Physics script I'm using. it's heavily modified for my game. I am trying to think what else I've done that would have made it work for me. Double check your action steps for the platform.
I've double checked my action steps. All set to no gravity. I'll check your script now.
 
@kbogle, after I found out there was a missing STA tempB in my doHandlePhysics_PlatformBase.asm in the GRAVITY section. The vertical platform start moving up and down. I leave it alone for almost an whole hour and bingo, no more going up glitch!

The objects details you also provided, (the pics), however, did not do any differences with mines.

But many thanks to you, the 3 scripts you provided did the job.

So to resume my testing and what I did for the main provider of these wonderful moving platforms method, @SciNEStist:

I replaced all the code for the moveUp.asm or platformUp.asm with this kbogle code:

TXA
STA tempA
LDA #%00000001 ;; goes up
TAY
LDA DirectionTable,y
STA tempB
LDA FacingTable,y
STA tempC
StartMoving tempA, tempB, #$00
ChangeFacingDirection tempA, tempC

And then, I replaced all the code for the moveDown.asm or platformDown.asm with this kbogle code:

TXA
STA tempA
LDA #%00000000 ;; "down"
TAY
LDA DirectionTable,y
STA tempB
LDA FacingTable,y
STA tempC
StartMoving tempA, tempB, #$00
ChangeFacingDirection tempA, tempC

And finally, I added this kbogle code at the end of doHandlePhysics_PlatformBase.asm between doneWithGravity and skipPhysics:

VerticalMovement:
LDA Object_direction,x
AND #%00100000
BEQ +noVertMovement
;; there is vertical movement
LDA Object_direction,x
AND #%00010000
BEQ +isUpMovement
;; is down movement
LDA Object_y_lo,x
CLC
ADC myMaxSpeed;Object_v_speed_lo,x
STA yHold_lo
LDA Object_y_hi,x
ADC myMaxSpeed+1;Object_v_speed_hi,x
STA yHold_hi
CLC
ADC self_bottom
CMP #BOUNDS_BOTTOM ;#240

BCS doBottomBounds
JMP +noVertMovement
doBottomBounds:
CPX player1_object
BEQ +isPlayer
DestroyObject
JMP skipPhysics
+isPlayer
LDA yPrev
STA yHold_hi
STA Object_y_hi,x
; LDA #$00
; STA Object_v_speed_hi,x
; STA Object_v_speed_lo,x
; LDA #$00
; STA screenUpdateByte
; JSR doHandleBounds
JMP skipPhysics
+isUpMovement
LDA Object_y_lo,x
SEC
SBC myMaxSpeed;Object_v_speed_lo,x
STA yHold_lo
LDA Object_y_hi,x
SBC myMaxSpeed+1;Object_v_speed_hi,x
BCC +doTopBounds ;; helps if top bounds is zero.
STA yHold_hi
CMP #BOUNDS_TOP
BEQ +doTopBounds
BCC +doTopBounds
JMP +noVertMovement
+doTopBounds
CPX player1_object
BEQ +isPlayer
DestroyObject
JMP skipPhysics
+isPlayer

LDA yPrev
STA yHold_hi
STA Object_y_hi,x
; LDA #$00
; STA Object_v_speed_hi,x
; STA Object_v_speed_lo,x
; LDA #$02
; STA screenUpdateByte
; JSR doHandleBounds
JMP skipPhysics
+noVertMovement
 

kbogle

Member
@kbogle, after I found out there was a missing STA tempB in my doHandlePhysics_PlatformBase.asm in the GRAVITY section. The vertical platform start moving up and down. I leave it alone for almost an whole hour and bingo, no more going up glitch!

The objects details you also provided, (the pics), however, did not do any differences with mines.

But many thanks to you, the 3 scripts you provided did the job.

So to resume my testing and what I did for the main provider of these wonderful moving platforms method, @SciNEStist:

I replaced all the code for the moveUp.asm or platformUp.asm with this kbogle code:



And then, I replaced all the code for the moveDown.asm or platformDown.asm with this kbogle code:



And finally, I added this kbogle code at the end of doHandlePhysics_PlatformBase.asm between doneWithGravity and skipPhysics:
Glad it's working perfect for you now. :)
 
Top Bottom