# Circular Maze Path Help

Get help using Construct 2

### » Fri Feb 22, 2013 9:04 am

Hi everyone,

I am in need of some advice on the following screenshot which I hope explains what I am trying to do.

I have the rotation working fine, and I can get the straight segments easily done. But what I don't know how to do is:

- chose clockwise or counterclockwise (e.g. 7-8 should have gone the other way in the diagram)
- stop rotating and go straight

Please note, I only have coordinates to the odd numbered X,Y positions.

Could someone please lend a hand on this issue for me?

Thanks. :)Brett Elliott2013-02-22 09:13:55
B
5
Posts: 19
Reputation: 513

### » Tue Feb 26, 2013 7:15 am

"I am in need of some advice on the following screenshot which I hope explains what I am trying to do."

Not really. Is it somebody trying to find a path through a maze? Or is the whole thing rotating?

But I'll try to help. Could you use "distance" to decide which way to rotate? Also when to stop, when you are at the closest distance along the circular path.

https://www.scirra.com/manual/126/system-expressions
distance(x1, y1, x2, y2) Calculate distance between to points

B
7
S
1
Posts: 38
Reputation: 626

### » Tue Feb 26, 2013 7:43 am

You only have coordinates to the odd-numbered positions? How do you know where to place 8 then? And for the previous arcs, how do you decide whether to go clockwise or counterclockwise from the previous chord? Are these Cartesian coordinates or polar coordinates?

I think a bit more explanation or a caps would help!
B
8
S
2
G
3
Posts: 83
Reputation: 2,668

### » Tue Feb 26, 2013 10:53 am

Thanks for the replies!

Sorry for not being more specific the first time.

The object moving along the path is an enemy AI sprite.

The path is the inside of a tubular tunnel (center is the vanishing point). So as the object moves towards an edge it gets bigger etc. So the thought process of travelling in a circular motion is so I can get the enemy to move from 1 side of the tunnel to the other without crossing the vanishing point (that looks weird). In total I have randomly placed 10 waypoints for each enemy wave and they should repeat until they are destroyed and so on.

The even positions in the diagram are easily calculated by going to the odd point and drawing a line to the vanishing point, where the circle and the line intersect gives you those coordinates.

I have placed a link to the capx below, but it's the full thing (warts and all). It also uses the SpriteFont plugin.

The scripts to look at are on the GAME sheet within the ENEMY_AI and WAYPOINTS groups.

Please let me know if there is anything in there that needs clarification.

http://dl.dropbox.com/u/31121080/WHI_V0.1_AI_Movement_Failure.capx

Thanks, BrettBrett Elliott2013-02-26 11:06:02
B
5
Posts: 19
Reputation: 513

### » Tue Feb 26, 2013 10:23 pm

Hey Brett, I wasn't able to download the plugin and I couldn't figure it out from looking at the xml of your event sheet. Sorry! I hope someone else will be able to help you out.
B
7
S
1
Posts: 38
Reputation: 626

### » Tue Feb 26, 2013 10:29 pm

No worries, thanks for the time you spent on it. :)
B
5
Posts: 19
Reputation: 513

### » Wed Feb 27, 2013 9:57 am

Thanks to anyone who looked at this I've managed design something that works nicely (not exactly as I envisaged but a good effect non the less).

I'm removing the capx from Dropbox now. ;)

Cheers, Brett
B
5
Posts: 19
Reputation: 513