[4.5.9] Physics Script Help (abrupt stop when player collides with solid above)

Jonny

Well-known member
I've been looking at my doHandlePhysics script trying to figure this out but its to complex (to me anyway) and there are things I don't understand about collision points so asking for some help...

So, at the moment when player jumps left or right and touches a solid tile above, instead of continuing their trajectory smoothy (as in most NES platformers) they stop abruptly.

Sorry about the Ducktales gif but I just want to show what I mean in comparison. Happy to remove it if needed or change to another example. I just want to show the difference.
In the DT example, it looks seamless, almost like the jump vertical speed increase is just being stopped, then gravity script brings scrooge down, like a normal jump.

DTexample.gifBHDsample.gif

Has anyone looked into this or any pointers where I might start? Maybe I'm looking in the wrong place to try and solve this?

Thank you :)
 

Jonny

Well-known member
Think I've got this one now (at last!)... modified SOLID tile type below...

Code:
;;; SOLID FOR ALL OBJECTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    LDA ObjectUpdateByte
    ORA #%00000001
    STA ObjectUpdateByte
    
;;; CHECK SOLID ABOVE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    LDY Object_type,x
    LDA Object_x_hi,x
    CLC
    ADC self_left
    STA temp
    JSR getPointColTable
    
    LDA Object_y_hi,x
    CLC
    ADC self_top
    CLC
    ADC Object_v_speed_hi,x
    SEC
    SBC #$01
    STA temp1
    CheckCollisionPoint temp, temp1, #$01, tempA
    BNE dontStopVerticalMovement

;;; STOP VERTICAL MOVEMENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    LDA yPrev
    STA Object_y_hi,x
    STA yHold_hi

dontStopVerticalMovement:
 

Jonny

Well-known member
Holy DAMN! Nice work @Jonny !!!
I've already implemented it. This is huge!
Great. I presume it works ok for you too?

If anyone is wondering how some bumbling idiot came up with this, the check part is from AI action stoponsolid_platformer_prize included with NM and the stop vert movement is something I read from DC.. thank you @dale_coop
 

9Panzer

Well-known member
I'll test it tonight to see if it breaks something else - but my quick test worked great!
 

9Panzer

Well-known member
Okay so it seems to have worked with only one flaw which might just be my game. Enemies and enemy objects are effected by the change to the solids and it causes them to ignore their GUI instructions. My quick a easy fix was to add a check right at the beginning of the new part of the solid code to see if its a player or not.

CPX player1_object
BNE dontStopVerticalMovement

That fixed it up for me! :)
 
Top Bottom