[4.5.6] Grab Hook Tile Mechanic (Platformers)

DocNES

Member
@Jonny Mahalo. I'll give it a look over, though my skill are limited. Funny timing, I was actually looking at some old code from Mugi on their wall grab, that allows for jumping by bypass gravity based jumping, since gravity is turned off when you hang on the wall.

I haven't been successful yet with it.

To do so, the following will have to be added and adapted to your jump script. I believe it uses some old commands that aren't in the current version.

Code:
GetCurrentActionType player1_object
CMP #$06
BEQ doWallClimbJumpThing
JMP dontDoWallClimbJumpThing

doWallClimbJumpThing:
ChangeObjectState #$02, #$03 ; Assumes Tile #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:
 

Bucket Mouse

Active member
I've been experimenting with the hook grab code today and think I solved some of its problems.

For one thing, you said this was crashing:
Code:
;;; IF HANGING JUMP REGARDLESS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;    GetActionStep temp3  ;;  **** CAUSES CRASH !!!!! **** ;;
;    CMP #$06             ;;  **** CAUSES CRASH !!!!! **** ;;
;    BNE +carryonchecks   ;;  **** CAUSES CRASH !!!!! **** ;;
;    JMP +doJump          ;;  **** CAUSES CRASH !!!!! **** ;;

It crashes because nothing is loaded into temp3. I'm not sure why you put that there, as it's supposed to be the player sprite, therefore it should check #$00. I changed it to that and I was able to jump off the hooks.

Second, the "grab" Action Step does not need to have gravity off. It works without it.

Third, the way you have it set up in this section, only pushing Up lets you jump off the hook.

Code:
isThePlayer:
LDA gamepad        
CMP #%00100000      ;; DOWN, LEFT, OR RIGHT ;;
BCS dontGrab

Most people will be pushing Left or Right when they jump to the next hook, and with those rendered nonfunctional, they will fall off. That section should actually be like this:

Code:
isThePlayer:
LDA gamepad        
CMP #%00100000      ;; DOWN ;;
BEQ dontGrab
 

dale_coop

Moderator
Staff member
Regarding the "GetActionStep temp3" issue, you can just add:
Code:
STX temp3
before.
Or if you want to check the player object action step, you can also directly write:
Code:
GetActionStep player1_object
 
Top Bottom