create a movement area

Get help using Construct 2

Post » Tue Apr 09, 2013 6:22 pm

Ok, perhapps im looking at this the wrong way, and im making things more complicated than they should be

basically, i have a map, on that map seen from above, i have an unit, when i click on that unit, i want a circle to appear below it, that circle represents the movement area.

that is done

What i cant do is set the 8 directions movement on the unit to stop within the boundaries of the circle that appeared below.

I have this to make the circle appear below the unit



any ideas on how to make the unit move only whithin the circle?

thank you
B
4
Posts: 14
Reputation: 378

Post » Tue Apr 09, 2013 8:03 pm

I managed to make it move this way




But i need to make it stop when it reached the edge.

i tryed this,



But even making the stop area transparent, it allways detects as overlaping, so it starts adn stops moving at the same time, i tryed collision instead of overlapping, but what happens is that i leave the circle, still moving, and when i try to reenter, it colides and stops moving. so it detects the collision from outside in but not from inside out

is there any way to set a condition as "is no longer overlaping" ?
B
4
Posts: 14
Reputation: 378

Post » Tue Apr 09, 2013 8:34 pm

Please, @blonduck, provide me the CAPX and I will fill it with a sample code for you, because it's too much longer to write on a post, and there I can comment the code.
ImageImageImageImageImageImage
B
93
S
20
G
12
Posts: 1,212
Reputation: 18,482

Post » Tue Apr 09, 2013 8:38 pm

here it is

http://www.filedropper.com/tbgtest1

thank you for the help
B
4
Posts: 14
Reputation: 378

Post » Tue Apr 09, 2013 8:44 pm

Since your range is circular, you could limit the hero's movement based on the distance between the hero and the movement area. If the distance between the 2 sprites is greater than the range, set the hero's position according to its maximum range and angle compared to the movement area. It sounds more complicated than it is, you just need some basic trig. You can do it all in a single event. Here's a demo and capx with the method using a single event, and the method broken out for explanatory purposes:


Demo
Capx

An added benefit is that there is no collision detection to take up processing power. I hope this helps.
B
44
S
13
G
7
Posts: 338
Reputation: 10,379

Post » Tue Apr 09, 2013 8:49 pm

I could not open the Capx file, could it be restricted to the full version?
B
4
Posts: 14
Reputation: 378

Post » Tue Apr 09, 2013 8:52 pm

@blonduck

Making a sprite transparent doesn't stop it from being overlapped, the issue is that your movement and non-movement zones overlap each other. Why don't you just say when not overlapping the movement zone? DO an overlap condition, then right click on it and choose invert. So then you have one for moving in the zone, and stopping when you are no longer in it. Or even better, do an else.

Character Overlapping MovementZone > 8 Direction Movement Enabled
Else > 8 Direction Movemenet Disabled
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Tue Apr 09, 2013 8:53 pm

interesting, didnt know about tha tpossibility, ill go check it out
B
4
Posts: 14
Reputation: 378

Post » Tue Apr 09, 2013 8:55 pm

Whatever version of C2 are you using? The capx was created using release 124. If you're using a previous release, it won't open. I don't think the file being created using the full version would affect your ability to open it. Regardless, there isn't much to the code. Here's a screenshot of the event sheet:
zatyka2013-04-09 21:16:59
B
44
S
13
G
7
Posts: 338
Reputation: 10,379

Post » Tue Apr 09, 2013 9:03 pm

yea, i had release 119, uim upgrading right now :D

thank you so much
B
4
Posts: 14
Reputation: 378

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests