How To Make Slow Tiles and Slow Tile Script Included

TolerantX

Active member
Greetings and salutations!
This tutorial will show you how to make a slow tile script and some physics edits for the ADVENTURE module, and "possibly" others.

INCLUDED: SLOW_TILE_ADVENTURE.ASM - 5 LINES OF CODE
doHandlePhysics_Adventure_Ex - MINOR EDITS TO ADVENTURE PHYSICS

THE SCRIPT EDITS WILL ALSO BE SHOWN IN THE VIDEO.

I am using doHandlePhysics_AdventureBase.asm (from the MOD_Adventure/Subroutines folder)
IF YOU EDIT YOUR SCRIPTS ALWAYS BACK UP SCRIPTS BEFORE EDITING.
(OTHER FEATURES, SUCH AS THE SLOW TILE BEING DESTROYABLE WILL BE IN FUTURE TUTORIALS.)
MAKE SURE TO SAVE ALL CHANGES

1. GO TO PROJECT SETTINGS > SCRIPT SETTINGS
ADD A NEW VARIABLE NAME IT slowTile SET IT'S VALUE AS ZERO 0

2. The following is my script for the slow tile. (if you don't want to copy it, you can download it)

Code:
;;;;; TILE COLLISION FOR SLOWING PLAYER SPEED ;;;;;

	CPX player1_object
	BNE notPlayer
		LDA #$01
		STA slowTile
notPlayer:

View attachment Slow_Tile_Adventure.zip

3. Go to Project Settings > Script Settings and add the tile to a collision for a tile (example: I use 10 or 11 usually)


4. Next you open your folder NESmaker is in...
Go to: GameEngineData > Routines > BASE_4_5 > Game > MOD_AdventureBase > Subroutines > copy the doHandlePhysics_AdventureBase.asm


5. After copying the physics script, look for the following line:
line 284 +notHurt (UNDER THAT LINE YOU CAN BEGIN EDITING)
make a few blank lines of code as a buffer then add this at line 285:

Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; I ADD A CHECK FOR A VARIABLE A SLOW TILE INCREASES ;;;

	CPX player1_object
	BEQ isPlayer
		JMP +doNormalPhysics

isPlayer:
		
		LDA slowTile
		CMP #$01
		BNE +doNormalPhysics
			LDY Object_type,x
			LDA ObjectMaxSpeed,y
			ASL
			ASL
			ASL
			ASL
			ASL	  
			ASL
			ASL
			STA myMaxSpeed
			LDA ObjectMaxSpeed,y
			LSR
			LSR
			LSR
			LSR
			LSR
			LSR
			LSR
			STA myMaxSpeed+1
			;;; now high max speed byte is the actual high byte of speed
			;;; low max speed byte is the low byte of speed
			LDA #$00
			STA myAcc+1
			LDA ObjectAccAmount,y
			STA myAcc
			JMP +endDoNormal

+doNormalPhysics

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

As part of this script edit also on line 349 it should say "STA myAcc" then slightly lower it says: ;; ReturnBank ;;
ABOVE the line that says RETURN BANK add the following:

Code:
+endDoNormal	;; SLOWTILE REQUIRES THIS ;; ALSO SEE END OF SCRIPT ;;
	
;;;;;;;;;;;;;;;;;;

Now for the final Physics Script edit...
At the bottom of the script the line after skip physics: ADD THE FOLLOWING

Code:
	LDA #$00				;; SLOWTILE REQUIRES THIS ;;
	STA slowTile

View attachment doHandlePhysics_Adventure_Ex.zip

6. Go to Project Setting>Script settings look for subroutines. Find Handle physics. change it for your new physics code by going to MOD_AdventureBase\Subroutines\dohandelPhysics_AdventureBase_Ex



THAT'S IT!

Explanation: You make a tile that calls upon a variable that when colliding with the tile sets the variable to 1.
The variable now at 1 "flips the switch" on the physics script edit and tells it to slow the player down...
The end of the physics turns the variable "switch" back to off
You can change the speed the player is slowed by editing ASL and LSR lines adding more or less as you see fit.
Have fun and stay safe!

VIDEO TUTORIAL BELOW

https://youtu.be/7aOKmw0U4zw
 

Logana

Well-known member
um i did this and it did absolutly nothing idk imma do some messing around in the thing but it had no effect wether i was on or off the tile
 

TolerantX

Active member
Logana said:
Could you possibly show some examples of it working ? As well

Did you both follow the tutorial every specific thing in it and watch the video? The video shows an example of it working. Maybe a better way would be for you to show me possibly a video of you doing this process and it not working. Honestly I'm surprised it's doing nothing at all differently. You used the adventure module and before you edited everything you backed up the defaults?
 

Logana

Well-known member
I can show you everything I’m currently at a friends house, imma take a look at the video again so if I missed anything
 

Logana

Well-known member
Could it be possible that it’s messing with the other variable I set up for palletcycles? Idk I’m really new to using the script settings
 

TolerantX

Active member
Logana said:
Could it be possible that it’s messing with the other variable I set up for palletcycles? Idk I’m really new to using the script settings

It shouldn't be messing with anything else. did you make the physics script the physics script you edited?
 

JamesNES

Well-known member
Weird, I had the same problem. The slowTile variable was already zero when it was being checked in the physics script, so it never ran the slowing down part. But the only time it was changed was at the end of the physics script. I have a special tile for clearing status changes so I just put the slow tile clearing part in that and it was fine. The slowing down bit is really cool, thanks!
 

Subotai

Active member
I can confirm that your script is functionnal on the Arcade Platformer Module.

Thanks a lot for sharing it TolerantX.
 

vanderblade

Active member
I'm using this with a LR_platformer_camera and scrolling and a Metroidvania projectile script. It works great to slow the player down, but for some reason, every time I fire my projectile, it negates the slow tile and I momentarily return to full speed. Why might this be?

Also, adding gravity effects to this to simulate underwater physics would be perfect. I'll keep tinkering.
 
Last edited:

vanderblade

Active member
I had issues with the above method, so I just decided to simplify it. The below code, when placed in a tile script, will give you slow movement (about half your normal movement speed).

Code:
    CPX player1_object
    BNE +skip

        LDA Object_h_speed_hi,x
        LSR A
        STA Object_h_speed_hi,x
      
      
    +skip
    RTS

Edit: My camera script was a little messed up. Not sure if the default camera has the issue where the player will eventually catch up to the camera, but this problem is solved using Davey's recentering technique: https://www.nesmakers.com/index.php?threads/4-5-6-scrolling-with-recentering.6144/
 
Last edited:
Top Bottom