[4.5.6] Ice Physics (meant for LR Platformers)

TheStrahl

New member
So this is meant for the LR Platformers, but I think it might work with others. This was an adaptation of a script Dale wrote in an earlier version that no longer worked. I had to tweak some things and write some simple codes in other places. I'm honestly surprised it worked lol.



STEP 1:
First Open up your game settings and go to the User Variable Tab. Click the Add button at the top and then click on the new Variable and name it "onIce" Be sure to leave the value at 0.

While we're in here we will also Go to Project Lavels > Tile Types and Click Tile 13. Rename it to something like Ice or Slippery.

Step 2:
Next we need to make a new .ASM file to apply to our Tile 13. Go to your NESmaker folder then go to Routines > Base_4_5 > Game > Subroutines

Here we will create a new Text file. Open it up and paste the following code inside of it.

Code:
;; set the ice bit:
    LDA #$01
    STA onIce

Once you've pasted it go to File > Save as and save the file as IceTiles.asm

Step 3:
Go back into your game settings and go to the Script Settings Tab. Scroll all the way down to your Tile Types folder. No we will go to Tile 13. (or whatever tile you want,) and click on it and hit the Change button. Paste this into the Script path and then close the game settings.

Routines\BASE_4_5\Game\Subroutines\IceTiles.asm

Step 4:
Now we need to paste some code. We going to edit the doHandlePhysics_PlatformBase.asm file. To to scripts > Defined Scripts > Game > SubRoutines > Handle Physics.

Now we're going to go to line 126 and paste in this bit of code.

Code:
        ;; object is on ice?
        LDA onIce
        AND #$01
        BEQ +
        LDA #$08    ;;<<-- Change this to anything between maybe 5-10 to get decent ice physics. 8 is pretty solid.
        JMP ++
        +
        LDA ObjectAccAmount,y
        ++
        STA myAcc
        JMP +doneWithAccFetch




That's it, you should have functional ice tiles. A few things to note.

1.) Place the slippery tile ABOVE the solid tiles that you want to be slippery. You could make the ice tile itself solid, but I haven't figured out how. Pasting the Solid tile code into the ice tile code makes this weird sticky tile that's kind of interesting.

2.) The physics aren't perfect. Jumping completely cancels out the forward momentum. I'm not quite sure how to fix this yet. Maybe someone else can figure it out.

3.) I don't know if this works on other Modules, so you'll likely have to try and adapt it for yourself.


Update:
1. It doesn't work in Adventure Modules.

2.) You can carry out your horizontal momentum if you stack the slippery tiles even higher up in the air (at least as high as your jump height)
 
Last edited:

Jonny

Well-known member
Yes dude! Thank you very much for putting this together. I'm definitely going to try it out.
 

TheStrahl

New member
Let me know if it works for you. I did the tutorial like a week after actually doing it so I may have left something out.
 

Logana

Well-known member
I think I’m gonna try this on the adventure module and see if it works, it’s atleast with trying
 

PewkoGames

Member
I tried it in the Arcade Platormer and when I paste the line in 126, all my monsters and player fall down the screen as if gravity got turned off.
 

Logana

Well-known member
Tried this in the platformer module witch it was ment for and it didn’t work at all, and when I got the game functioning the tile didn’t work, could you possibly have a quick video showing how to do it with proof it works at the end?
 

Logana

Well-known member
Let me know if it works for you. I did the tutorial like a week after actually doing it so I may have left something out.
Just wondering, bought that because, I really wanted to do an ice level because it’s near Christmas
 

Logana

Well-known member
What error message are you getting?
No werror message, just completely breaks the physics, so you can’t move left or right. Or any inputs at all, so it’s not technically wrong but it doesn’t work and locks up the game
 

Logana

Well-known member
no just in general with the game, in the video I had the player on a solid tile and it looked like his collision just disappeared
 
Top Bottom