Making Action Only Occur When Player is Within Range...

Just started using Construct 2? Post your questions here

Post » Sat Dec 03, 2016 6:58 am

...make an action only occur when the player character is within a certain range of an object.

Mouse - On left button clicked on object - System - Go to Layout 2.

You can click on this object from anywhere on the map. I'd like to make it so that it's only clickable when the player is right next to the object. I've Googled this and tried a few different things, but nothing has seemed to work.
B
6
S
3
Posts: 9
Reputation: 568

Post » Sat Dec 03, 2016 9:10 am

I use a transparent helper sprite object that you can call an additional condition in your mouse event that detects overlap of the helper sprite

or

just add another condition to your Mouse event ...-->

System--> compare two values--> distance(player x,y,object x,y) < (whatever range you want)



just a few ways..hope that helps :geek:
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
35
S
13
G
8
Posts: 318
Reputation: 7,685

Post » Tue Dec 06, 2016 2:55 pm

Make that sprite GLOBAL
B
251
S
39
G
15
Posts: 1,964
Reputation: 40,723


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests