How do I control spawn variable/flexible

Get help using Construct 2

Post » Tue Jan 05, 2016 3:55 pm

Hi there,
these are my first steps with construct.
I've set up a tiny space shooter and wanted to know, how to control the spawning and collisions of my enemies in a flexible way.
The capx file can be downloaded here:

(move with arrows, shoot with "A")

In there you see the problems i have:
- For each enemy type (Enemy/Enemy2 ...) i'd have to repeatedly set the spawn and colllisions. That's impossible because there will be a ton of enemy types ...
- I'd like to implement another spawn system. Now, every time a "wave" is killed, another wave is generated immediately. I'd like to have some wait time between the spawn.
- The "wave handling" (see at the bottom of the capx file) is aweful! This has also to be completely flexible.
- Additionally there's a problem with the health bar. Because "Enemy" has the HealthBar as a container, i can't select "HealthBar" as in the container of "Enemy2". So i have to clone the Health bar and this doubles the code needed for the health bar too.

At the moment i only have the free version, so families aren't possible for me to use.

Best regards and thanks for every info :)
Last edited by geibi on Tue Jan 05, 2016 4:27 pm, edited 1 time in total.
Posts: 4
Reputation: 183

Post » Tue Jan 05, 2016 4:24 pm

E.g. the "Spawn Enemies" and "Spawn Enemies2" sections should be only one. Something like:
- Every tick
- Check if the current wave is completed
- Depending on the CurrentWave" variable spawn either Enemy, Enemy2, Enemy3 aso
- Additionally it would be great, if at this place one could choose a random number and depending on this number, an Enemy type is selected.
So i could alter randomly e.g. in wave 2:
If random == 2 choose randomly from Enemy2, Enemy3, EnemyX aso.
Posts: 4
Reputation: 183

Post » Tue Jan 05, 2016 8:38 pm

I found the rex_nickname plugin for flexible creation of instances.
But: If i create an instance by nickname, which could be a variable string, i dont know how to access it afterwards.
- i have a string "Enemy" which is a variable and could also be "Enemy2"
- the string is stored in "PickedEnemyObjectName"
- i create an instance via the Nickname plugin via: "Create PickedEnemyObject at (0,0) on Layer 0
- the whole thing happens in a for loop
- inside the for loop and after the creation i want to set x and y positions for the variable object. but i can't add an action because i dont' t know wich object i created. normally i would do: add action->Enemy->set x but "Enemy" is the variable instance, created via Nickname, which could also be "Enemy2"

Posts: 4
Reputation: 183

Post » Sun Jan 10, 2016 7:36 pm

Maybe this could be done via functions?
Posts: 4
Reputation: 183

Return to How do I....?

Who is online

Users browsing this forum: QuantumMMX and 12 guests