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

Get help using Construct 2

Post » Sat Jul 29, 2017 7:44 am

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?
B
7
S
2
Posts: 4
Reputation: 483

Post » Sat Jul 29, 2017 11:58 am

You can use NOT overlapping at offset to achieve this:

https://www.dropbox.com/s/5qqsnpty5stey ... .capx?dl=0
B
20
S
8
G
3
Posts: 458
Reputation: 4,055

Post » Sat Jul 29, 2017 9:04 pm

Ah, that did the trick. Thanks! I was overthinking it, as usual.
B
7
S
2
Posts: 4
Reputation: 483


Return to How do I....?

Who is online

Users browsing this forum: Kin and 29 guests