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)
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:
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:
Now for the final Physics Script edit...
At the bottom of the script the line after skip physics: ADD THE FOLLOWING
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
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