Z
Zakarul
Guest
i don't know what's wrong with this code.
this is a script that start right after a "ledge grab script" and, in this way, i should be able to pull up my character without having direct control. just like this. https://media.giphy.com/media/l0MYAXkWeyON64x3y/giphy.gifProblem is that this "pull up" script worked perfectly good 3 months ago and now it doesn't. The "only" different thing from 3 months ago is that now i use a different sprite I can even scrap this code and make another but i don't know a different way to make it.
this script works that every frame of the sprite, the character moves up or right/left, for a certain amount of pixels (explained in the first lines of code). My sprite have 30 frames(that's why is so long). In the end, thanks to "state = scr_player_movestate", it should stop and return to the basic script but it doesn't. It just fly away with the animation in loop. i tried to use the "animation end "event but it was useless. thank you!! I am desperate....
the code: this trigger the pull up script from the scr_player_ledgegrab
the scr_pullup script
this is a script that start right after a "ledge grab script" and, in this way, i should be able to pull up my character without having direct control. just like this. https://media.giphy.com/media/l0MYAXkWeyON64x3y/giphy.gifProblem is that this "pull up" script worked perfectly good 3 months ago and now it doesn't. The "only" different thing from 3 months ago is that now i use a different sprite I can even scrap this code and make another but i don't know a different way to make it.
this script works that every frame of the sprite, the character moves up or right/left, for a certain amount of pixels (explained in the first lines of code). My sprite have 30 frames(that's why is so long). In the end, thanks to "state = scr_player_movestate", it should stop and return to the basic script but it doesn't. It just fly away with the animation in loop. i tried to use the "animation end "event but it was useless. thank you!! I am desperate....
the code: this trigger the pull up script from the scr_player_ledgegrab
Code:
if ((key_jump && -key_left) && (place_meeting(x-1,y,obj_wall)))
{
sprite_index = spr_grabbing_R
image_xscale = -1;
state = scr_pull_up;
}
if ((key_jump && key_right) && (place_meeting(x+1,y,obj_wall)))
{
sprite_index = spr_grabbing_R
image_xscale = 1;
state = scr_pull_up;
}
Code:
//Pull up script
var height_number = (sprite_height) / (image_number/2)
if ((key_jump && -key_left) && (place_meeting(x-1,y,obj_wall)))
{width_number = ((sprite_width) / (image_number/2)) * -1}
else
if ((key_jump && key_right) && (place_meeting(x+1,y,obj_wall)))
{width_number = ((sprite_width) / (image_number/2))}
if image_index = 0 // one for every frame
{
y -= height_number
}
if image_index = 1
{
y -= height_number
}
if image_index = 2
{
y -= height_number
}
etc... (it was too long to post it here so i made a cut)
if image_index = 14
{
y -= height_number
}
if image_index = 15
{
y -= height_number
}
if image_index = 16
{
x += width_number
}
if image_index = 17
{
x += width_number
}
etc...
if image_index = 28
{
x += width_number
}
if image_index = 29
{
state = scr_player_movestate
}