• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Climb up a ledge fixed animation

Z

Zakarul

Guest
Hi,
i have, maybe, a stupid problem...
basically i am trying to make my character climb up a ledge. For now my character can stand on a ledge(withing a script) and jump up(leaving the script) but prefer to play a fixed animation of him climbing it and standing on it. just like this

https://media.giphy.com/media/l0MYAXkWeyON64x3y/giphy.gif


i was able to do something by teleport my character up and left/right by using the timeline(by assigning a number to x and y in different steps). i don't want it to teleport, but move it so i can play the correct sprite.
giving a number my vsp and hsp do nothing in the timeline (i don't want to use hspeed and vspeed even if they work)

what is the best way to it?

Thank you!!

the creation code for my character (obj_player)

Code:
///INIT
grav = 0.4;
hsp = 0;
hsp_carry = 0;
vsp = 0;
jumpspeed = 9;
walljump = true;
movespeed = 4;
wallspeed = 2;
facingRight = true;
hp = 100;
key_down = 0;
can_move_block = false
grounded = false

state = scr_player_movestate

this is the ledge grab script:
Code:
///scr_ledge_grab_state()
scr_player_input()
var key_jump = keyboard_check_pressed(vk_space)
var key_down = keyboard_check(vk_down)
var key_up = keyboard_check_pressed (vk_up)


if ((key_jump && key_left) && (place_meeting(x+1,y,obj_wall))) || ((key_jump && key_right) && (place_meeting(x-1,y,obj_wall)))
{
    vsp = -jumpspeed;
    state = scr_player_movestate;
}

if (key_down) {
    state = scr_player_movestate;
}

if (key_up) && (place_meeting(x-1,y,obj_wall) || place_meeting(x+1,y,obj_wall))
        {
    timeline_index = tml_climbup_action;
    timeline_position = 0;
    timeline_running = true;
    timeline_loop = false;
        }
 
Last edited by a moderator:

Tsa05

Member
Since you're using a state machine setup, why not have a climbing state that moves through each subimage of a climb sprite and then changes state to standing? The climbing state would ignore player input, and would simply advance the animation (and move the character)
 
Z

Zakarul

Guest
Since you're using a state machine setup, why not have a climbing state that moves through each subimage of a climb sprite and then changes state to standing? The climbing state would ignore player input, and would simply advance the animation (and move the character)
Thank you!
i think i did something

from the ledge state
Code:
if (key_attack)
    {
        sprite_index = spr_climb
        state = scr_pull_up;
    }
and this from the pull up state

Code:
if image_index = 12
{
        y -= 32
        x -= 32
state = scr_player_movestate;
}
my only worry is that he teleport at the end and not move toward it
is it possible to move the hitbox/mask every image number? or i have to stick with a single "fixed" mask? maybe with this "sprite_collision_mask" and set sepmasks to true....


OMG i did it!!
this is the new pull up code

Code:
//si tira su


if image_index = 1
{
        y -= 6.4
}
if image_index = 2
{
        y -= 6.4
}
if image_index = 3
{
        y -= 6.4
}
if image_index = 4
{
        y -= 6.4
}
if image_index = 5
{
        y -= 6.4
}
if image_index = 6
{
        x -= 8
}
if image_index = 7
{
        x -= 8
}
if image_index = 8
{
        x -= 8
}
if image_index = 9
{
        x -= 8
state = scr_player_movestate;
}
 
Last edited by a moderator:
Top