TAKEN FROM A DISCORD CONVERSATION
Guide by Pvic
i was able to make the code for a hang so here's how I did it
alright so I made an animation for Sonic called "hang" and made it halign perfectly with the hang object as you can see here
https://cdn.discordapp.com/attachments/391328195556802561/396769408132841483/unknown.png
(there's only the first frame in game)
https://cdn.discordapp.com/attachments/342648041678962692/396771533101596674/unknown.png
i set the origin to be the same as sonic's sprite placed the sonic hang sprite in spr_sonic
https://cdn.discordapp.com/attachments/342648041678962692/396771720523939843/unknown.png
here's the sonic sprite btw
https://cdn.discordapp.com/attachments/342648041678962692/396771806448451595/unknown.png
here's the hang sprite
https://cdn.discordapp.com/attachments/342648041678962692/396771848634892311/unknown.png
animation_hang_start = 94;
animation_hang_end = 94;
animation_hang_loop = 94;
animation_hang_speed = 0.1;
animation_hang_repeat = true;
animation_hang_repeat_times = -1;
animation_hang_linked_to = "(none)";
placed this in the animations_normal script and this script in the animations set:
if ( action == ConActHang && animation != "hang" )
{animation = "hang"};
(edited)
https://cdn.discordapp.com/attachments/342648041678962692/396772228449959942/unknown.png
now on to the actual code which is what you all are actually interested
make obj_hang https://cdn.discordapp.com/attachments/342648041678962692/396772424944713739/unknown.png
Create:
triggered=false;
canbetriggered=true;
Step:
if triggered==true
{
global.main_player.x=floor(x);
global.main_player.y=floor(y);
global.main_player.action=ConActHang;
if global.main_player.key_action_pressed
{
triggered=false;
global.main_player.action=ConActJump;
canbetriggered=false;
global.main_player.speed_y=-4;
sound_play(snd_player_jump)
}
}
if canbetriggered==false
{
if instance_exists(global.main_player)
{
if global.main_player.ground==true{
canbetriggered=true;
}
}
}
collision with par player:
if other.ai_flag==false{if canbetriggered=true{triggered=true;}}
draw:
draw_sprite(sprite_index,image_index,floor(x),floor(y))
and that's it you can also make that the hang go in crazy paths and stuff
i hope this helps someone