[4.5.6] [SOLVED] Wall Grab and CheckCollisionPoint

AllDarnDavey

Active member
Nice!

I was having some issues with your version at first but it was because my jump input script wasn't changing my action state, making my jump check fail, I didn't notice at first because my jump animation looks like my idle. Possibly a slight difference in the mods we started with. But once I fixed my jump script, yours worked like a charm too.

Looking into "CheckCollisionPoint" Vs. "GetCollisionPoint". CheckCollision says, "Is the collision tile here this type?" and it returns no or yes, 0 or 1. GetCollision says, "what number is the collision tile at this point?" and returns that number.

Technically either one could work, but it's strange and a bit redundant to have both macros. I personally would just have "GetCollisionPoint" as it's more useful then a strict boolean, and you can still check if it matches the collision you want.

Maybe there's some performance savings using one over the other in certain circumstances I don't see.

Anyway, enough code rambling by me... GLAD YOU GOT IT WORKING!
 

Jonny

Well-known member
I'm currently trying to adapt your code into a chain hold using a dedicated walkable/null tile type instead of a solid one. It kinda works (almost)! This is what I've changed so far...

1. Assigned an input script so when UP is released the player lets go of the chain/hook or whatever they're holding onto. So besically player only grabs while UP is being held.

2. Then I changed the jump input script and added the dedicated tile type im using for the grab tile as one of the tile types it checks the player is standing on / coliding with.
(so player can jump from chain to chain, not fall to the floor)

3. Tweeked the left and right values in your script and the tile type check till it worked pretty nicely.

The only issue im getting now is the sometimes when im pressing UP, left or right and B (jump) my players action type changes to GRAB and the player glides in mid air left or right. It usually happens if I try to grab the grab tile but the player is too low. I've tried a few different things with input scripts and the GRAB action type for my player but not managed to get it right yet. I think its possible so I'll keep trying. I know when the player is getting stuck in GRAB action because I changed that action to have a timer. The player only moved until the timer finished.

Anyway, thanks for the code. Once I understand it a bit more I might be able to achieve my chain grab.
 

Mugi

Member
just reading this and figured i'd point out that while my wallgrab code is quite a bit different since it's a tile code, it did originally have the same "limitation" of not being able to jump out of it.
if you do wish to have that, it's a fairly easy thing to fix.

in order to be able to jump from a grab state (akin to this script, mine uses ignore gravity for the wallgrab, which disables jumping.) one simply has to bypass the problem of not being able to jump because of <condition>

what i did was simply added a check in my jup script that if the player is on wallgrab state, and you press jump, the object movement speed is set to the jump values instead of attempting to execute the normal jump script which as we know, doesnt work.

as such;

Code:
   GetCurrentActionType player1_object
   CMP #$07 ; wallgrab action state (grravity is disabled)
   BEQ doWallClimbJumpThing
   CMP #$05
   BNE notHurting_jump
   RTS
doWallClimbJumpThing:
    ChangeObjectState #$02, #$03
    LDA #$00
    SEC
    SBC #$A0 ; #JUMP_SPEED_LO
    STA Object_v_speed_lo,x
    LDA #$00
    SEC
    SBC #$06 ; #JUMP_SPEED_HI
    STA Object_v_speed_hi,x
    RTS
notHurting_jump:

in this code #$07 is the wallgrab state, and the values i set to the H_speed and V_speed are same ones that my actual jump uses, so this code is actually invisible to user in the sense that it would be a separate code. It simply behaves identical to a normal jump
 
Top Bottom