Detecting what tile under sprite

0 favourites
  • 6 posts
From the Asset Store
slide the tiles to fill the board.60 awesome levels.
  • I'm practicing on making a platformer. right now trying to make enemy that patrols back and forth over bunch of tiles. think of it like Mario's enemies how they go back and forth. for that i need to detect if the enemy is about to reach the end of the tiles so then it can reverse its direction.   How do I achieve this? I tried to search the forum, but may be I didn't use right terms.

    I tried using specific tile x and width, I was able to make it reverse direction on reaching the start, but reaching the end I couldn't because as far as i can see there is no way to detect how many tiles arranged in that area to calculate the end of that particular platform.

    I tried using sin movement, but then this will be a problem since platforms are not equal in length.   also I didn't find a way to detect in what direction that movement of the sin is going into so that I can mirror the sprite.

    In sum: How to detect what tile/sprite/object exist in specific x y?


  • I thought now of different approach, by having invisible walls for enemies if on collision reverse direction. still if someone knows how to detect what object on x,y, please share. thanks

  • You can achieve this by using "Is overlapping at offset".

    Here's an example I whipped up.

    Example .capx

    Basically just checks if there is a floor a certain distance to the right or left depending on the direction it's moving and then changes directions accordingly.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks a lot! that exactly what I was looking for.

  • No problem :)

    Here's a 2 event version using ternary operation. I'm bored ^^;

    Example2 .capx

  • thanks Tokinsom, unfortunately, I can't view the file because it says different version, I need to download the beta. I ll do that today and have a look. thanks (; I appreciate it.

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