How do I make a bullet rotate on its origin?

Get help using Construct 2

Post » Sat Aug 26, 2017 7:09 pm

When I use the bullet behavior in conjunction with the rotate behavior I have sprites rotating not on their origin point but in circles. How do I make an object move like a bullet but rotating on its center along the way?
B
15
S
7
G
4
Posts: 30
Reputation: 3,291

Post » Sat Aug 26, 2017 9:52 pm

Turn off "set angle" in the bullet behavior properties and it should be fine.
Normally that just makes bullet objects automatically point in the direction of their natural angle of motion, but having Rotate on there forces it to turn at a fixed rate while the bullet keeps moving forward at the constantly changing angle. So it's still rotating around its origin, but it's steering in a circle.
Last edited by Ahr Ech on Sat Aug 26, 2017 10:42 pm, edited 2 times in total.
B
35
S
9
G
4
Posts: 201
Reputation: 5,182

Post » Sat Aug 26, 2017 9:52 pm

I think with the bullet Behaviour, the sprite will move forward only. So, I guess you need to remove the "Bullet" behaviour and make your own bullet system. You should give it a shot, it's not too much work.
My first project:
Image
B
20
S
8
G
1
Posts: 172
Reputation: 2,463

Post » Sat Aug 26, 2017 10:16 pm

Ahr Ech wrote:Turn off "set angle" in the bullet behavior properties. Normally that just makes bullet objects automatically point in the direction of their natural angle of motion, but forcing it to rotate makes it fly in circles.
I tried but the object no longer moves towards the moving target I set with the option set angle towards position. It's like setting off the angle option conflicts with the action set-angle-towards-position.
B
15
S
7
G
4
Posts: 30
Reputation: 3,291

Post » Sat Aug 26, 2017 10:32 pm

Pin a rotating sprite to an invisible bullet.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Aug 26, 2017 10:50 pm

beguinner wrote: I tried but the object no longer moves towards the moving target I set with the option set angle towards position. It's like setting off the angle option conflicts with the action set-angle-towards-position.

Oh right, you'll have to use the bullet's Set Angle of Motion instead.
Since you can't use the specific Set angle Towards Position action, you can just use this when setting the angle of motion.
Code: Select all
angle(x1, y1, x2, y2)
.
Replace the first set of X and Y with your bullet's position and the second set with your target's position.
B
35
S
9
G
4
Posts: 201
Reputation: 5,182

Post » Sun Aug 27, 2017 6:48 am

@beguinner Try my tutorial it might help you out a bit! https://www.scirra.com/tutorials/9548/c ... -mechanism
Image
B
30
S
16
G
12
Posts: 316
Reputation: 9,825

Post » Mon Aug 28, 2017 12:05 am

Ahr Ech wrote:
beguinner wrote: I tried but the object no longer moves towards the moving target I set with the option set angle towards position. It's like setting off the angle option conflicts with the action set-angle-towards-position.

Oh right, you'll have to use the bullet's Set Angle of Motion instead.
Since you can't use the specific Set angle Towards Position action, you can just use this when setting the angle of motion.
Code: Select all
angle(x1, y1, x2, y2)
.
Replace the first set of X and Y with your bullet's position and the second set with your target's position.


I tried but I get the same result as before.
B
15
S
7
G
4
Posts: 30
Reputation: 3,291

Post » Mon Aug 28, 2017 12:10 am

99Instances2Go wrote:Pin a rotating sprite to an invisible bullet.


looks like this is the only viable option. :evil:
B
15
S
7
G
4
Posts: 30
Reputation: 3,291

Post » Mon Aug 28, 2017 1:26 am

@beguinner
Instead of using the bullet behavior, use rexrainbow's MoveTo behavior to get the movement you want.
B
65
S
36
G
111
Posts: 117
Reputation: 60,853

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000, Maako, Yahoo [Bot] and 6 guests