How do I set angle for bullet on a self spinning object.

Get help using Construct 2

Post » Sat Sep 27, 2014 11:37 am

Hello guys,

I am trying to set a straight shooter object which is spinning on its own center. It is a sprite set.

I set the shoot point on the head site of the object and set it for each sprite image.

It is shooting but always on the same angle and to the same direction. But I want it to shoot straight ahead from the head to 0 degrees.

My object rotates by 30 degrees. I set the timer per 4 seconds to shoot. So Icould not find a solution for my problem.


If anyone can help me out it is highly appretiated.

Cheers
Cantek
B
11
S
3
Posts: 44
Reputation: 823

Post » Sat Sep 27, 2014 12:54 pm

Do you mean:
set bullet angle of motion - object.angle?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Sep 27, 2014 1:43 pm

Lets say, there ıs the rocket launcher, whıch ıs stupıd and just turning around, I want it to fire on the side, direction that it looks at that moment.

I am not sure what to understand from your suggestion. I already tried to set the angle of the bullet as launcher.angel , It did not work. Bullet always goes to same direction no matter the direction of the launcher.

Cheers
B
11
S
3
Posts: 44
Reputation: 823

Post » Sat Sep 27, 2014 1:51 pm

I attached the code I have and the screenshot of what is happening. Maybe it can explain better.
You do not have the required permissions to view the files attached to this post.
B
11
S
3
Posts: 44
Reputation: 823

Post » Sat Sep 27, 2014 2:56 pm

OK,
I did it.

The motion and so on are useless if you do not know what is the angle exactly. So I calculated the angle of the current Sprite and used it to set the motion angle of the bullet.

set motion angle -> black2.AnimationFrame * 22.5

This solved the problem, ofcourse if you are starting from the 0 and if your gun is looking to 0 degrees.

Cheers
B
11
S
3
Posts: 44
Reputation: 823


Return to How do I....?

Who is online

Users browsing this forum: Cubeeo and 43 guests