Help with angle and bullet - can't figure this thing out!

Get help using Construct 2

Post » Sun Sep 10, 2017 7:19 pm


I've got one main project, where I am working on. Now, there's another project I created for testing.

The test project runs just fine - this technique works as I want it to.

However, after having copied the 'technique' to my main project, I noticed there is an unexpected result.

This 'result' is that the bullets spawned by object 'Flak' don't head to the direction of the object B17. The bullet has a speed of 50. As soon as the object Flak is onscreen you can see it shoots to the top and slowly corrects to the direction of the B17.

However.. when I set the speed of the Bullet fired by Flak (in my main project) higher to say, 200 speed then it will immediately fire to the center of the B17. When I set it to 100, it'll start by shooting to the right.

And when I change the speed of the bullet down to 50 in the TEST project, it'll work just fine. Heck, I can set it to whatever I want and it will always head towards the center of the B17.

I'm going nuts here. I've checked the imagepoints, I checked the pivot point directions, everything seems to be the same as in the test project. Well, except from a few additions like resizing etc. that I already tried disabling but still it wouldn't make any difference.

Yet it doesn't work properly. What the hell is going on?

So here's the code from the main project:


And the test project:


If anyone can figure this out..? I'd be really grateful!

- R
Posts: 145
Reputation: 3,610

Post » Mon Sep 11, 2017 5:21 am

There must be something else in the main project that causes this problem.
Could you share the main CAPX? You can remove all the unrelated things from it, just leave the part with flak and bullets.

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
Posts: 2,202
Reputation: 82,985

Post » Mon Sep 11, 2017 12:16 pm

Hey @Rudi55!

Is there a reason you're setting the angle inside a "Every tick" event? Do you understand that, in this case you are re-setting the angle every tick, for every Shot, even when the angle is already set? Also, the action to set the Shot's size repeats itself a lot.

Maybe you should consider a "On Created" event for the Shots, which would do all this (set initial size and set angle), which would make it happen imediately on creation, and leave the "Every tick" event just for adjusting the size dynamically.

Hope it helps! Cheer!

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
Posts: 718
Reputation: 4,008

Return to How do I....?

Who is online

Users browsing this forum: burak22, draiza, kelany and 4 guests