How to make an actor hang from a high platform.

Don't know how to make something and can't find a tutorial? Ask for one here.

How to make an actor hang from a high platform.

Postby Kcee » Fri Feb 24, 2017 11:39 am

Please could some one give me the code that would make an actor hang from a platform?
Currently working on: Super Stick Brawl.
User avatar
Kcee
 
Posts: 265
Joined: Tue Feb 14, 2017 5:40 pm
Location: Dimension GE
Score: 13 Give a positive score

Re: How to make an actor hang from a high platform.

Postby juansimat » Fri Feb 24, 2017 3:46 pm

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.
̿̿¯̿̿¯̿̿'̿̿̿̿̿̿̿'̿̿'̿̿̿̿̿'̿̿̿)͇̿̿)̿̿̿̿ '̿̿̿̿̿̿\̵͇̿̿\з=(๏̯͡๏)=ε
User avatar
juansimat
 
Posts: 152
Joined: Sat Dec 19, 2009 8:23 am
Score: 27 Give a positive score

Re: How to make an actor hang from a high platform.

Postby Kcee » Fri Feb 24, 2017 3:56 pm

Thanks a lot! That's all I need.
Currently working on: Super Stick Brawl.
User avatar
Kcee
 
Posts: 265
Joined: Tue Feb 14, 2017 5:40 pm
Location: Dimension GE
Score: 13 Give a positive score

Re: How to make an actor hang from a high platform.

Postby Kcee » Fri Feb 24, 2017 4:01 pm

Where can I get the game you uploaded?
Currently working on: Super Stick Brawl.
User avatar
Kcee
 
Posts: 265
Joined: Tue Feb 14, 2017 5:40 pm
Location: Dimension GE
Score: 13 Give a positive score

Re: How to make an actor hang from a high platform.

Postby juansimat » Fri Feb 24, 2017 4:07 pm

Kcee wrote:Where can I get the game you uploaded?


In the forum of Game Development. I will upload the project files.
̿̿¯̿̿¯̿̿'̿̿̿̿̿̿̿'̿̿'̿̿̿̿̿'̿̿̿)͇̿̿)̿̿̿̿ '̿̿̿̿̿̿\̵͇̿̿\з=(๏̯͡๏)=ε
User avatar
juansimat
 
Posts: 152
Joined: Sat Dec 19, 2009 8:23 am
Score: 27 Give a positive score


Return to Tutorial Requests

Who is online

Users browsing this forum: No registered users and 1 guest