Spawn object towards another with correct angle

Get help using Construct 2

Post » Fri Nov 04, 2011 4:59 pm

Hey guys,

I'm making a game similar to "Space Blaster" demo where an enemy fires a sprite towards the players X,Y co-ordinates. The only difference i am not firing a spherical object but a sort of laser, thus when it flies towards the user its angle is always different which doesn't make it realistic. I need it to spawn with the correct angle facing the user where ever he is and fly at him.
I tried changing the angle and all but no luck, i think its a math problem were i'm hopeless.

Here is a sample .capx file explaining better the problem

http://dl.dropbox.com/u/13810427/Battle.capx
B
12
S
2
G
5
Posts: 23
Reputation: 3,320

Post » Fri Nov 04, 2011 5:03 pm

The texture of "laser" has to face right.

Open the image editor, rotate the texture (6 button from the left in the top bar) and your problem is solved.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Fri Nov 04, 2011 5:08 pm

omg you're right, could you explain why it has to face right to work?
B
12
S
2
G
5
Posts: 23
Reputation: 3,320

Post » Fri Nov 04, 2011 5:12 pm

Because right is equivalent to 0 in C2. (down 90, left, 180, up 270)Kyatric2011-11-04 17:13:19
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Fri Nov 04, 2011 5:13 pm

This might be a good place to mirror a little feature idea back from the CC days that even had a little illustration:



How about a "default angle" for all the new sprites? For example facing up seems super-intuitive to most human beings, since, you know, we are kinda vertical. So a way to set where the initial angle faces would be really useful. It could be a project-wide setting which you set at project creation, for example. Set it to "up" and suddenly that shmup isn't an exercise in frustrating clockwise turns, but just awesome fun and games.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Fri Nov 04, 2011 5:14 pm

Ohhhh didn't know that. Thanks :)
B
12
S
2
G
5
Posts: 23
Reputation: 3,320

Post » Fri Nov 04, 2011 6:27 pm

[QUOTE=Somebody] This might be a good place to mirror a little feature idea back from the CC days that even had a little illustration:
[/QUOTE]

LOL!

What a great way to visualize how the angles work in C2. I doubt I will ever forget that now. Thanks for that!
B
22
S
5
G
6
Posts: 57
Reputation: 4,487


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 9 guests