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
25
S
8
Posts: 219
Reputation: 2,181

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)
Find all the Construct 2 games that were on Steam Greenlight here
B
37
S
10
G
7
Posts: 491
Reputation: 7,082

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
25
S
8
Posts: 219
Reputation: 2,181

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.
Find all the Construct 2 games that were on Steam Greenlight here
B
37
S
10
G
7
Posts: 491
Reputation: 7,082

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
262
S
46
G
15
Posts: 2,000
Reputation: 41,919

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
25
S
8
Posts: 219
Reputation: 2,181


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests