How do I fix my turrets from randomly shooting 2 bullets?

Get help using Construct 2

Post » Sun Apr 30, 2017 5:39 pm

I seem to have a bug with my turret behavior. All my turrets are sometimes shooting 2 bullets instead of one. Is there a known fix for this?
B
10
S
4
Posts: 34
Reputation: 874

Post » Mon May 01, 2017 12:25 am

Should be something wrong in your events. It's impossible to say without taking a look at it. If you can, share a capx. You can also take a look at the turret behavior template.
B
122
S
41
G
40
Posts: 846
Reputation: 27,894

Post » Mon May 01, 2017 1:45 am

Like andreyin says, it is in your events not in the behavior itself. Go through your events line by line and also the properties panel for the turret behavior and you should spot where it is spawning two. If all else fails post your .capx or a screenshot of your events using mediafile or imgur and put spaces in the url if your rep isn't high enough w w w . f o rexample. c o m
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 635
Reputation: 9,331

Post » Mon May 01, 2017 11:58 am

Image

These are all the events about the object. I don't see any issue with them.
Can any system events be the problem?
B
10
S
4
Posts: 34
Reputation: 874

Post » Mon May 01, 2017 1:07 pm

Logically it looks to be ok. I would think the cannon ball is being spawned twice during the on-shoot during certain instances due to the angle calcs.. try adding a "trigger once" system condition to the angle calculation sub-events if it will let you.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 635
Reputation: 9,331

Post » Mon May 01, 2017 1:18 pm

chrisinfinger wrote:Logically it looks to be ok. I would think the cannon ball is being spawned twice during the on-shoot during certain instances due to the angle calcs.. try adding a "trigger once" system condition to the angle calculation sub-events if it will let you.


Didn't solve it, only make it sometimes not shoot at all.

I think the problem is in the bullet spray. It rotates the turret same time as it shoots, so maybe it sometimes rotates back and triggers again. Any other way of making a bullet spray?
B
10
S
4
Posts: 34
Reputation: 874

Post » Mon May 01, 2017 1:47 pm

Ahh, yes I see it now. You are right if the angle is close to the min-max when it sets the random 4,8 angle it will trigger again.

Hmm.. maybe create an event that simply sets a variable "canFire" that is set to 1 every tick that the turret "could" be firing and then condition that variable in the onshoot event.. canFire=1. It would need to be set to 0 whenever turret shouldn't be firing.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 635
Reputation: 9,331


Return to How do I....?

Who is online

Users browsing this forum: JaredX, ksiads, Magistross, Rable and 6 guests