0 Favourites

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

  • 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?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You can use NOT overlapping at offset to achieve this:

    https://www.dropbox.com/s/5qqsnpty5stey ... .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)
Similar Topics Posts Views Last Post
Unread hot topic
217 18,528
humanescape's avatar
humanescape
Unread hot topic
99 10,136
karshinkoff's avatar
karshinkoff
Unread hot topic
102 6,402
Ashley's avatar
Ashley Construct Team Founder