[4.5.9] Fix the edge issues with the scrolling in the Metroidvania module

dale_coop

Moderator
Staff member
Ok, I fixed that months ago, but I didn't know how to present it...
The scrolling in the Metroidvania module has really annoying issues with the edges (and "Left/Right Edge for scroll" in screen info), when sometimes your player just disapears off camera.
Like this:

edges.gif

To fix that issue, I made modifications on the stock Physics script ("doHandlePhysics_PlatformBase.asm") used by the Metroidvania module. All the lines I modified are commented, with "dale_coop").
If you have your own modified Physics scripts, you could just check my modifications and apply them to your script.
Else, if you are using the stock Physics script, you can just replace it with that one (I'd suggest to save that script as "doHandlePhysics_PlatformBase_fixed.asm" and assign that script to the "Handle Physics" script element in your "Project Settings > Script Settings", under "SubRoutines").


Here's, attached in a zip file and following @Convoy_Avenger 's feedback, I also included @TakuikaNinja 's seam collision fix.


I share it as it, for anyone that would like to test it. Maybe it could be fixed differently, feel free to share your modifications.
That one is the one I use :)
 

Attachments

  • doHandlePhysics_PlatformBase_fixedAndSeamFix.zip
    4.3 KB · Views: 22
Last edited:
Hmmm, I tried to combine this with the seam fix code, and I started falling through my level. Something might not be compatible there?
 
This is after moving your changes into my file, I may have missed some, or some changes might not have been compatible.
 

Attachments

  • doHandlePhysics_PlatformBase_SeamFix.zip
    4.7 KB · Views: 5

dale_coop

Moderator
Staff member
I see you made a lot of modifications in your script... and you haven't merged my modifications correctly with them.

For your issue, you need to add, line 539 :
Code:
STA tempB
Like this:
2022-09-12 18_29_37-doHandlePhysics_PlatformBase.asm - BASE_4_5 - Visual Studio Code.png
It should work better.


I see another issue in your script, those lines:
Code:
        ;;;;; ADD THIS PART ;;;;;
        CMP #$04
        BNE +isNotSolid
        JMP +isSolid
        +isNotSolid
should be written earlier, for example, before the "CMP #$0A" line.
Like this:

2022-09-12 18_33_00-doHandlePhysics_PlatformBase.asm - BASE_4_5 - Visual Studio Code.png
 
I'll try these out, thanks. Finally getting to testing my game, and the amount of vanishing player at screen edges is TOO DAMN HIGH!

EDIT: So this seems to have solved the holes, but there does occasionally seem to be solid blocks getting in my way.

Second Edit: But I did run through my whole game without getting deleted, so that parts working! Thanks!
 
Last edited:

dale_coop

Moderator
Staff member
I see a line missing in your script ...
line 516, add this line:
Code:
    JSR getPointColTable
Like this:

2022-09-12 21_19_36-● doHandlePhysics_PlatformBase_fixedAndSeamFix.asm - BASE_4_5 - Visual Stu...png
(that line is needed for the seam collision fix)
 
Hey Dale, after playing around with it some more, I'm still bumping into solid collision occasionally. It seems to be at the seam line, and I can usually jump over it. It's like my toe is getting stubbed on a square.
 
Sure, I think it's the same as you've attached here, I haven't made any other changes after the above, anyway.
 

Attachments

  • doHandlePhysics_PlatformBase_SeamFix.zip
    4.7 KB · Views: 2

baardbi

Well-known member
This fix can potentially be amazing, but...

I tried this, but I got a problem where there was suddenly NULL tiles on a solid road. So the player suddenly fell down while walking on a line of solid tiles. I changed my doHandlePhysics script with only the lines marked with ;;; dale coop. I also got a problem that the player would stop in mid-air if holding right against a solid tile while jumping. Like @Convoy_Avenger it seems like my problems mostly occur at the seam line (not the jumping thing).

Here is my modified script:
 

Attachments

  • doHandlePhysics_PlatformBase_baardbi.zip
    5.1 KB · Views: 1

dale_coop

Moderator
Staff member
Thank you guys, for your feedback. It helps.

So, to fix that issue, we'll replace the lines from 530 to 556:
2022-09-14 09_39_24-● doHandlePhysics_PlatformBase_fixedAndSeamFix.asm - BASE_4_5 - Visual Stu...png

With those lines:
Code:
    LDA Object_x_hi,x
    CLC
    ADC self_left
    STA temp
        JSR getPointColTable
    STA tempB
    LDA Object_x_hi,x
    CLC
    ADC self_right
    STA temp3 ;; the right bottom collision point.
        JSR getPointColTable
    LDA Object_y_lo,x
    CLC
    ADC Object_v_speed_lo,x
    LDA Object_y_hi,x
    ADC Object_v_speed_hi,x
    CLC
    ADC self_bottom
    STA temp1

This should fix that small null under feet that blocks your movements on seam.
 
Last edited:

dale_coop

Moderator
Staff member
For that part, yes (those lines are for the collision at seam), I incorrectly merged both script.
 

Peter Schmitz

Active member
I tried to combine it with the slope script but kinda failed. Now my character falls or gets stuck in solid ground (at the seams) and falls through jumpthrough platforms when there is a slope tile define right next to it on the left side.
 
Top Bottom