Spawn a guy on top of a random platform

Get help using Construct 2

Post » Sat Aug 17, 2013 6:52 pm

Hi, first post

I have a random spawned platform every 5 seconds, how do i make sure that an enemy will always be spawned on top of it and that he will not fall off while it moves?
B
9
S
2
Posts: 35
Reputation: 668

Post » Sat Aug 17, 2013 7:03 pm

@WhiteX
use the same logic that you are using for the platform on the enemy to spawn them randomly?
you can use the pin behaviour to pin the enemy to the object so it won't fall.
B
46
S
16
G
74
Posts: 2,089
Reputation: 44,187

Post » Sat Aug 17, 2013 7:15 pm

well, heres the thing, the platform spawns like this:

System - Every 5 seconds
System - Pick a random "Spawnpoint" instance >> System | Create obj platform om layer 0 at (spawnpoint.X, spawnpoint.Y)

Doing the same to the enemy will make it spawn, but to any spawnpoint, not necessarily the one where the platform appeared.

I tried to use it on a container bu when the guy dies, the platform goe kaput and i need it for the player to use
B
9
S
2
Posts: 35
Reputation: 668

Post » Sat Aug 17, 2013 8:28 pm

you have several options:
1.- Use a variable such as lastSpawnpoint
2.- Or store spawnpoint.X and spawnpoint.Y as param0 and param1 to pass to a function call.
3- Or use an array if the spawn positions are "fixed" (i.e. you want them to be created at defined positions)
4.- Another one: make the last created spawnPoint sprite have it's variable "IsThisSpawnPointTheLatestOne" set to True (and the others to False), so enemies can only be created there.
5.- Use IID

honestly SC2 makes it very easy :)
If you want to explore any of these just ask :)
ghost2013-08-17 20:39:58
B
12
S
3
G
1
Posts: 347
Reputation: 2,866

Post » Sat Aug 17, 2013 8:36 pm

Will it always be the same platform linked to the same enemy or are platforms and enemies completely random ?
B
46
S
16
G
74
Posts: 2,089
Reputation: 44,187

Post » Sun Aug 18, 2013 4:43 am

@Ghost- - it seems that 3 is the best bet, but i am a newbie on arrays
@plinkie, for now, it is a singe enemy on a singla platform, tomorrow will be a family of platforms on a family of enemies
B
9
S
2
Posts: 35
Reputation: 668


Return to How do I....?

Who is online

Users browsing this forum: David181, OBLIVION and 56 guests