How do I reference an image point to check for overlap?

0 favourites
  • 3 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • I've got a pretty simple platformer, and I'm trying to get my enemy AI to patrol back and forth on the platform, without walking off the side. The best solution I have found thus far is to place invisible walls that, on overlap with the enemy sprite, trigger the sprite to walk the other direction (I'm using an instance variable for this: Patrol = 0 => simulate control right, Patrol = 1 => simulate control left). However, with a lot of enemies on a lot of platforms, that's a lot of invisible walls to build and keep track of.

    So basically, I'm trying to cheat a lil bit :/

    I created two image points on my enemy sprite, located just outside the collision polygon, and just below, on either side. I named them "floordetectorright" and "floordetectorleft". The issue I'm having is that I can't find a way to reference these image points in a condition. My goal is something like:

    floortile is NOT overlapping point (sprite.imagepointX("floordetectorright"), sprite.imagepointY("floordetectorright")) => set patrol to 1

    The above would check whether the floor detector image point is overlapping with the floor, and if it isn't, it would trigger a change in direction. However, I'm not really seeing a way to do this. I tried messing around with Pick Object Overlapping Point, but that didn't seem to work.

    Any ideas? Or should I start building a fortress of invisible walls?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use NOT overlapping at offset to achieve this: ... .capx?dl=0

  • Ah, that did the trick. Thanks! I was overthinking it, as usual.

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