Kcee wrote:Please could some one give me the code that would make an actor hang from a platform?
If it's like hanging from a platform edge, i recently uploaded a game with that. If it's that what you want I can upload the code explained. ¿Or is something different, hanging from the ceilling?
Basically what I do is to check with
CollisionFree if collides with the right side or left side and if the above side of that position is free from collision
- Code: Select all
if(CollisionFree("Event Actor", x+5, y) == 0){//If returns 0, there's something that collides with, but can be a wall
if(CollisionFree("Event Actor, x+5, y-5) == 1){//If is free of collision above that side, then is an edge.
yvelocity = 0; //Apply this in Draw Event after gravity update to avoid actor falling (Hanged from platform)
}
}
Doing this way you get that your actor hangs from everything (Due to
CollisionFree checking with every actor that has collision enabled)
To avoid this you can reinvent the wheel of collision detecting in draw events if there are intersections (that don't work on tiles and is a lot of work), use
getActor to check if it's the platform (But I don't tested this function, so i don't know if it can work well) and, finally, what i've done, add collision events for right and left sides, and collision finish to check if it's colliding with the platform.
Also you need to tweak the variables to adapt it to your game.
I hope it helped to solve your problem. Please tell if you need more help.