Looking for expression / solution Bullet behavior

Get help using Construct 2

Post » Tue Mar 07, 2017 10:59 am

Image

Black dot every 1 second should spawn one blue arrow with bullet behavior
Arrow on created/spawned should randomly choose direction to fly in the hole
Black dot should NOT be rotated

What i should do ?
B
24
S
7
Posts: 208
Reputation: 2,032

Post » Tue Mar 07, 2017 11:45 am

@IGDev

Assuming you've already given the Blue Arrow the Bullet behaviour, add these two events:

System: Every 1 second -> Black Dot: Spawn another object - Blue Arrow

Blue Arrow: On created -> Set angle to random(360)
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
32
S
9
G
7
Posts: 444
Reputation: 6,731

Post » Tue Mar 07, 2017 11:47 am

OddConfection wrote:@IGDev

Assuming you've already given the Blue Arrow the Bullet behaviour, add these two events:

System: Every 1 second -> Black Dot: Spawn another object - Blue Arrow

Blue Arrow: On created -> Set angle to random(360)

Set random to 360 is wrong because arrow will multiple times miss hole
arrow on created should randomly sethis angle to holes position

when i use SET angle(self.X, self.Y, hole.X, hole.Y)
arrow go always to nearest hole and that is wrong
B
24
S
7
Posts: 208
Reputation: 2,032

Post » Tue Mar 07, 2017 11:50 am

IGDev wrote:when i use SET angle(self.X, self.Y, hole.X, hole.Y)
arrow go always to nearest hole and that is wrong


Pick a random hole!

[event] Blue Arrow: On Created
[sub-event] System: Pick random instance (hole) -> Blue Arrow: Set angle to angle(self.X, self.Y, hole.X, hole.Y)
Last edited by OddConfection on Tue Mar 07, 2017 11:56 am, edited 3 times in total.
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
32
S
9
G
7
Posts: 444
Reputation: 6,731

Post » Tue Mar 07, 2017 11:50 am

IGDEV try this

1 create Global variable Spawn_Time = 2
2 system every random (Spawn_Time) seconds ACTION BlackDot create bluearrow
3 set bullet speed to ACTION random(220,400)
4 set angle of motions ACTION random (360) degree
B
245
S
39
G
15
Posts: 1,941
Reputation: 40,246

Post » Tue Mar 07, 2017 11:55 am

OddConfection wrote:
IGDev wrote:when i use SET angle(self.X, self.Y, hole.X, hole.Y)
arrow go always to nearest hole and that is wrong


Pick a random hole!

[event] Blue Arrow: On Created
[sub-event] System: Pick random instance (hole) -> Blue Arrow: Set angle(self.X, self.Y, hole.X, hole.Y)



WORKS ! thanks :)
B
24
S
7
Posts: 208
Reputation: 2,032


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests