Why is my bullet behaviour changing direction?

Get help using Construct 2

Post » Thu Sep 26, 2013 11:47 pm

I'm working on a a game that's a sort of freerunner. But with spaceships (I like spaceships!). You hold the mouse/touch the screen to pause the forward movement, to avoid enemy spaceships.



I'm using the bullet behaviour for the Player, which seemed sensible. All it does is travel in a direction until it collides with a directional arrow, and inherits the arrow object's rotation as its angle of movement.

Seems sensible right? Well it works perfectly until after hitting the direction arrow and changing direction. Then a simple hold and release (changing the bulletspeed to 0 then back to 70 again) makes the spaceship fly in the opposite direction!!! I never asked it to change angle, so why is it changing direction?

I'd really appreciate it is someone more experienced could download my capx and have a look at what I'm doing wrong. This is my first real C2 project and I'm a bit stuck tbh.

Here's the download. https://dl.dropboxusercontent.com/u/24767479/c2%20project%20files/TrafficCars.capx

BTW I've also tried the custom movement behaviour, and this has exactly the same problem. I've tried saving the movement angle to a variable and setting it again after releasing, but this doesn't work either. downloadonion2013-09-26 23:48:10
B
12
S
2
G
3
Posts: 86
Reputation: 2,960

Post » Fri Sep 27, 2013 12:21 am

The angle of motion is based on the bullet's velocity. When you set the bullet speed to 0 it changes the angle of motion. When you release touch you'll need to set the angle of motion again after setting the speed.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,670

Post » Fri Sep 27, 2013 9:12 am

That makes a lot of sense. Thanks, I've fixed it by saving the angle to a variable, then using that when the ship starts moving again. Simple really, but I was chasing my tail around on this issue for ages.

Thanks so much @Ramones!
B
12
S
2
G
3
Posts: 86
Reputation: 2,960


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests