baardbi
Well-known member
Here's a tutorial for making levels with different gravity on specific screens based on screenType.
This can for example be used to make underwater levels or space type levels.
PS! This tutorial is made for platform type games.
1.
Make a backup of doHandlePhysics_PlatformBase.asm
It's located in ...\BASE_4_5\Game\MOD_PlatformerBase\Subroutines
2.
Comment out the lines about gravity. It's somewhere around line 475
;MAX_FALL_SPEED = #$04
;GRAVITY_LO = #$40
;GRAVITY_HI = #$00
3.
Then add user variables for every one of those constants
4.
Then remove the # in front of the references to gravity (somewhere around line 710)
ADC GRAVITY_LO
STA Object_v_speed_lo,x
LDA Object_v_speed_hi,x
ADC GRAVITY_HI
STA Object_v_speed_hi,x
LDA Object_v_speed_hi,x
CMP MAX_FALL_SPEED
Just to be sure, we're talking about these three values:
GRAVITY_LO
GRAVITY_HI
MAX_FALL_SPEED
5.
Make a backup of extraScreenLoad_PlatformBase.asm
It's located in ...\BASE_4_5\Game\MOD_PlatformerBase\Game
6.
At the end of the extraScreenLoad_PlatformBase.asm file put this:
LDA screenType
CMP #$01 ;;;; This is the screen type for special gravity
BEQ +specialGravity
JMP +finishedGravityCheck
+specialGravity:
LDA #$02
STA MAX_FALL_SPEED
LDA #$20
STA GRAVITY_LO
LDA #$00
STA GRAVITY_HI
+finishedGravityCheck:
7.
Set screen type to 1 on the screens you want special gravity on. The default here is 1 but can of course be changed.
8.
You should now have screens with low gravity. You can experiment with different values for MAX_FALL_SPEED, GRAVITY_LO and GRAVITY_HI for a different effect.
Let me know if something in this tutorial isn't working.
This can for example be used to make underwater levels or space type levels.
PS! This tutorial is made for platform type games.
1.
Make a backup of doHandlePhysics_PlatformBase.asm
It's located in ...\BASE_4_5\Game\MOD_PlatformerBase\Subroutines
2.
Comment out the lines about gravity. It's somewhere around line 475
;MAX_FALL_SPEED = #$04
;GRAVITY_LO = #$40
;GRAVITY_HI = #$00
3.
Then add user variables for every one of those constants
4.
Then remove the # in front of the references to gravity (somewhere around line 710)
ADC GRAVITY_LO
STA Object_v_speed_lo,x
LDA Object_v_speed_hi,x
ADC GRAVITY_HI
STA Object_v_speed_hi,x
LDA Object_v_speed_hi,x
CMP MAX_FALL_SPEED
Just to be sure, we're talking about these three values:
GRAVITY_LO
GRAVITY_HI
MAX_FALL_SPEED
5.
Make a backup of extraScreenLoad_PlatformBase.asm
It's located in ...\BASE_4_5\Game\MOD_PlatformerBase\Game
6.
At the end of the extraScreenLoad_PlatformBase.asm file put this:
LDA screenType
CMP #$01 ;;;; This is the screen type for special gravity
BEQ +specialGravity
JMP +finishedGravityCheck
+specialGravity:
LDA #$02
STA MAX_FALL_SPEED
LDA #$20
STA GRAVITY_LO
LDA #$00
STA GRAVITY_HI
+finishedGravityCheck:
7.
Set screen type to 1 on the screens you want special gravity on. The default here is 1 but can of course be changed.
8.
You should now have screens with low gravity. You can experiment with different values for MAX_FALL_SPEED, GRAVITY_LO and GRAVITY_HI for a different effect.
Let me know if something in this tutorial isn't working.