Angel of Motion Question

For questions about using Classic.

Post » Thu Mar 04, 2010 8:29 pm

What do I add for the Angle of Motion parameter if I want to to be the current mouse/cursor position?

*and thanks all for not commenting on the topic mistype. LOL
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Post » Thu Mar 04, 2010 8:45 pm

If you are using ball behavior, then using angle(sprite.x,sprite.y,mousex,mousey) will point it towards mouse.
B
2
S
1
G
4
Posts: 71
Reputation: 1,342

Post » Thu Mar 04, 2010 8:48 pm

I was using a custom movement but that worked great! Thanks!!!
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Post » Fri Mar 05, 2010 6:58 pm

What am I doing wrong? I want ONLY the Red or Blue sprite to change only when clicked on.
The way I had it set up is you click and hold the mouse on a sprite and when released it will set it's new heading to the point where you release the mouse button. For some reason they both head to the mouse.

http://www.box.net/shared/6ufzkqmor1


I am guessing my problem stems from I can click anywhere and they respond. It is only supped to respond to the clicked on sprite
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Post » Sat Mar 06, 2010 6:21 am

I would use a varaible to keep track of the last clicked unit (by unique id, of course). Then, upon releasing the mouse button, the unit whose unique ID matches the stored on in the global var has its angle of motion changed.

Lol and if that was confusing, ask and I (or anyone, for that matter) can provide you with an example.
B
2
G
3
Posts: 20
Reputation: 890

Post » Sat Mar 06, 2010 2:04 pm

I fixed it for you, using a similar method to what StAtrill mentioned.

Also I cleaned up the code a little by using a family, because at the moment, you don't want either of the sprites to behave any differently from each other code-wise, so its better than having the same code running twice!

[url:1iog9pof]http://dl.dropbox.com/u/1289341/Help/Traffic3.cap[/url:1iog9pof]
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Sat Mar 06, 2010 2:59 pm

Thank you Arcticus (again) for the help but I will have to think about your solution. I really need to sit down and get my head around family, and unique ID's. They are a little confusing right now.

But your solution may have solved my next step. I wanted to spawn many of those ships and the player keep them form crashing. I am guessing your solution will be the answer.

Many thanks!
B
28
S
8
G
8
Posts: 530
Reputation: 7,154


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests