Stop bullet at specific location

Get help using Construct 2

Post » Wed Feb 18, 2015 4:42 pm

Hello,

I currently have this going:

Event:

Enemy > Bullet distance _> 190
System > every 5 seconds

Actions:

Enemy > bullet speed to 0
Enemy > spawn Bullet on layer 1

Now the problem is I am spawning the enemies at specific locations on X, but the system only checks the bullet distance every 5 seconds. However, I do want the Enemy to fire every 5 seconds, AND the Enemy bullet speed to keep at 0 after 190 pixels travelled.

How can I get this done? Right now the enemies are stopping at random heights.
B
12
S
6
G
3
Posts: 117
Reputation: 2,902

Post » Wed Feb 18, 2015 5:36 pm

Maybe it would be a better option to use a Timer behavior on the enemy instance instead of using the "every X seconds" system condition ?

Can you provide a capx ?
B
12
S
7
G
7
Posts: 448
Reputation: 4,272

Post » Wed Feb 18, 2015 8:55 pm

Like Coin-coin le Canapin says use timer much better
B
231
S
33
G
14
Posts: 1,908
Reputation: 38,742

Post » Wed Feb 18, 2015 9:01 pm

How would I go about applying the timer behaviour? My game is almost finished, can I also post some more info instead, what would you need?
B
12
S
6
G
3
Posts: 117
Reputation: 2,902

Post » Wed Feb 18, 2015 9:06 pm

set timer = 0 as global variable
system add dt to timer
system timer =>5
set timer to 0
then do this, or do that or whatever
B
231
S
33
G
14
Posts: 1,908
Reputation: 38,742

Post » Wed Feb 18, 2015 9:18 pm

Hello,

thanks for your quick reply.

I tried following your instructions, but can't find 'add dt' anywhere. Where is it located? And how do I go about combining it with the code I showed in my original post?
B
12
S
6
G
3
Posts: 117
Reputation: 2,902

Post » Wed Feb 18, 2015 10:40 pm

dt is a system expression:
dt
Return delta-time according to the object's own timescale. See Delta-time and framerate independence for more information.


But I don't still really understand what effect you want to achieve. That said, english isn't my native language so…
---> enemy : set speed to 0

It would be easier to help you if we can have a link to your actual project.

Check my capx, is it what you want to do ?
You do not have the required permissions to view the files attached to this post.
B
12
S
7
G
7
Posts: 448
Reputation: 4,272

Post » Thu Feb 19, 2015 9:41 am

Here is demo for you how to use timer and dt
You do not have the required permissions to view the files attached to this post.
B
231
S
33
G
14
Posts: 1,908
Reputation: 38,742

Post » Thu Feb 19, 2015 10:09 am

I assume his enemies move with the bullet behavior and aren't shooting bullets.
B
12
S
7
G
7
Posts: 448
Reputation: 4,272

Post » Thu Feb 19, 2015 10:52 am

coin I have only done this demo to show how he can use timer and not about enemy or anything else
B
231
S
33
G
14
Posts: 1,908
Reputation: 38,742


Return to How do I....?

Who is online

Users browsing this forum: Kyatric, oddreal, oosyrag, waguilar and 2 guests