How do I make an enemy spawn outside the layout randomly

Get help using Construct 2

Post » Mon May 18, 2015 10:28 pm

I want to make a type of enemy spawn randomly outside the layout so that it doesn't have the same spawn every time, how can I do this?
B
5
S
1
Posts: 6
Reputation: 412

Post » Tue May 19, 2015 12:08 am

Every random(x,y) seconds, system create object [sprite] on layer [whatever] at random(0,LayoutWidth), random(0,LayoutHeight)... or whatever coordinates/space you wish.
B
13
S
5
G
4
Posts: 139
Reputation: 2,586

Post » Sun Feb 28, 2016 8:43 pm

+1
B
21
S
5
Posts: 44
Reputation: 1,644

Post » Mon Feb 29, 2016 5:15 am

Seems like sound logic :) + 1
B
8
S
1
Posts: 46
Reputation: 544

Post » Mon Feb 29, 2016 8:10 am

Except that OP actually asked for spawning outside the Layout?

There are a few different ways to do this
1. Create 4 different spawn zone for each side of the layout, create each one using the logic above. Then use a separate random check to determine which side's spawn to execute.
This Person is dealing with a similar problem/Solution: how-do-i-create-coordinate-exeptions_t169278

2. Create a separate SpawnPoint object, and position instances around the outer edge of your Layout, Then use an event with the condition "Pick random instance" of SpawnPoint ->Spawn another object to create enemies.
This is bit more of a basic approach, and isn't truely random, but personally it's what I'd do because it has the advantage of being visual.
B
8
S
2
Posts: 32
Reputation: 620


Return to How do I....?

Who is online

Users browsing this forum: minigame, tannerdler, zenox98 and 6 guests