How do I control spawn variable/flexible

0 favourites
  • 4 posts
  • 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:

    dropbox.com/s/a6oossn17ewlvit/spacey.capx?dl=0

    (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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

    e.g:

    • 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"

    headache^^

  • Maybe this could be done via functions?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)