[Solved] Make a character only cling to certain walls?

0 favourites
  • 2 posts
From the Asset Store
2d mushroom sprite 2d game mushroom character enmy sprite game art
  • I have a character that can cling to walls, and it basically functions well, but I want to have some control over what is considered a 'wall'. Because the character can cling nearly to the tops or bottoms of a solid (including sides of an object with 'Sine' behavior, e.g., a moving platform, which causes crazy sliding up and down) and still be considered 'Having a wall to left/right', I want to create a way to control the behavior. As it stands, there doesn't seem to be any way to put 'If sprite is colliding with [object]' as a condition in an event, so no matter what the wall is "made of", the game still treats the left and right sides of it like a wall.

    Here are some examples of what I find...undesireable:

    I tried changing the size of the hidden collision box when the character was on the wall, but that caused problems when the character left the wall (such as getting stuck in ceilings because the height of the bounding box suddenly doubled).

    I hope I'm making sense. I want to make it so the character can only cling when it's touching a certain object.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Never mind, solved.

    I turned on collisions for the player sprite and added a condition requiring that the sprite, not the collision box, is overlapping the specific wall object in order for the wall clinging variable to return true. Also added an event that stated that if the character was in the wall clinging animation and somehow ended up not overlapping the wall object, the character releases the wall and falls. It works perfectly.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)