Mugi
Member
so might aswell try and write a proper forum thread for this since i already shared it out on the thread i made earlier.
so here's a wall grab tile:
just save it as wallgrabtile.asm and assign it to an unused tiletype. (the script assumes that wall grab tiletype is 03, change in the tile code if necessary.)
This tile assumes that your wall grab action state is #$07
and requires action state 07 to have "ignore gravity" set
this tile requires modifications to be made to the players jump script, to bypass gravity based jumping, since gravity is turned off when you hang on the wall.
to do so, the following will have to be added and adapted to your jump script.
in addition, extracontrollscript will need the following piece of code in order to disable L/R from the dpad during wall climb.
so here's a wall grab tile:
Code:
CPX player1_object
BNE dontMessWithGravity
LDA gamepad
AND #%00010000 ; is up pressed ?
BEQ dontMessWithGravity
LDA Object_v_speed_hi,x ; are we falling downwards ?
BMI dontMessWithGravity
CLC
ADC Object_y_hi,x ; are we in map bounds ?
CMP #$10
BCC dontMessWithGravity
CMP #$D6
BCS dontMessWithGravity
LDX player1_object ; fetch facing direction of player
LDA Object_movement,x
AND #%00001111
CMP #%00000110
BEQ doLeftCollisionCheck
LDA collisionPoint1 ; compare top right collision point
CMP #$03 ; compare against "wallgrab tile"
BNE dontMessWithGravity
JMP doGrab
doLeftCollisionCheck:
LDA collisionPoint0 ; compare top left collision point
CMP #$03 ; compare against "wallgrab tile"
BNE dontMessWithGravity
doGrab: ; enable grabbing the wall
ChangeObjectState #$07, #$03
dontMessWithGravity:
just save it as wallgrabtile.asm and assign it to an unused tiletype. (the script assumes that wall grab tiletype is 03, change in the tile code if necessary.)
This tile assumes that your wall grab action state is #$07
and requires action state 07 to have "ignore gravity" set
this tile requires modifications to be made to the players jump script, to bypass gravity based jumping, since gravity is turned off when you hang on the wall.
to do so, the following will have to be added and adapted to your jump script.
Code:
GetCurrentActionType player1_object
CMP #$07
BEQ doWallClimbJumpThing
JMP dontDoWallClimbJumpThing
doWallClimbJumpThing:
ChangeObjectState #$02, #$03
LDA #$00
SEC
SBC #JUMP_SPEED_LO
STA Object_v_speed_lo,x
LDA #$00
SEC
SBC #JUMP_SPEED_HI
STA Object_v_speed_hi,x
RTS
dontDoWallClimbJumpThing:
in addition, extracontrollscript will need the following piece of code in order to disable L/R from the dpad during wall climb.
Code:
LDX player1_object
GetCurrentActionType player1_object
STA temp
CMP #$07
BNE +
LDA gamepad
AND #%00111111
STA gamepad
RTS
+