# How do I, set AI at different bullet speed? C2

0 favourites
• 4 posts
• Hi Community,

I'm trying to create a zombie chase game. My Zombies spawn randomly on layout; however, I'm trying to get them to all have their own bullet speed.

-----------------------------------------------------------------------------

On start of layout>

Repeat 10 times | System:Create Object:Zombie on layer1 at (floor(random(0, 100)), floor(random(0, 100))

Zombie has LineOfSight to Player | Set angle towards (player.x, Player.y)

Zombie Set Bullet speed to 40

-----------------------------------------------------------------------------

I think the issue might be, they have line-of-sight. When they spot the player, they increase speed.. but they all chase at the same speed. How do I get them to have have their own speed?

So I tried an Instance var on the zombie

speed=10

Then altered the LoS

Zombie has LineOfSight to Player | Set angle towards (player.x, Player.y)

Zombie Set speed to floor(random(10, 30))

Zombie |Set Bullet speed to zombie.speed

but this seems to alternate, not what I want.

Thanks again,

Roberto

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• I think I sussed it out.

Zombie has LineOfSight to Player | Set angle towards (player.x, Player.y)

Zombie |Set Bullet speed to zombie.speed

System | Trigger Once

| Zombie Set speed to floor(random(10, 30))

• I think I sussed it out.

Zombie has LineOfSight to Player | Set angle towards (player.x, Player.y)

Zombie |Set Bullet speed to zombie.speed

System | Trigger Once

| Zombie Set speed to floor(random(10, 30))

you should set the zombie speed before you use it like this

C:>Zombie has LineOfSight to Player

|A:> Set angle towards (player.x, Player.y)

Sub C:> System | Trigger Once

|A:> Zombie Set speed to floor(random(10, 30))

|A:> Zombie |Set Bullet speed to zombie.speed

• Thanks GeorgeZaharia