Create random events

0 favourites
  • 4 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • I have been building a tower defence game, but to make my game a little more unique and replayable I am trying to build the waves so that when a wave is completed the next wave is randomily chosen from a selection of wave events.

    So I would create various wave events e.g. spawn this many ships of this type etc 5 seconds apart for 10 seconds etc. And group them somehow.

    That way i can have say 500 different potential waves. And everytime one is completed the game randomily chooses another wave to begin. Some waves might have set requirements e.g. a certain score or energy level etc.

    Can anyone advise if this is possible and if it is if they can point me towards how i would begin building something like this within the game so i can push forward myself. (p.s. ideally i wouldnt want the layout to change between waves, more a continuous game with short pauses between waves for the player to catch their breath.

    thank you for any responses and thoughts.

  • Use groups.

    Make them deactivated by default and name them something like "Wave0", "Wave1", "Wave2", etc...

    Then let's say we are in "Wave0" group (the group is activated) and the wave is finished and it's time to pick another one.

    The conditions of the event depends how you want to set it (change after a certain amount of time, of mobs spawnt, etc...) but the actions will look something like :

    system - group "Wave0" (the current group) deactivate

    system - group "Wave" & int(random(NbMaxWave)) activate

    Where NbMaxWave is a global variable that holds the highest number of wave you have programmed.

    The expression will pick a random number between 0 and the max number of waves (for example 500) and concatenate it to form a string that is the name of the next group that will be activated. (From "Wave0" to "Wave25" for example).

  • wow thanks.. that is exactly what i was looking for. I thought groups would be the best way but werent sure how to randomise the selection process.

    Thank you for your help :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi, I am having some issues getting the next group and event sequence to activate... Could you take a look at my current capx file to see if you can point out where i am going wrong?

    I was trying to set it so that at present when 100 enemies have spawned, enemies stop spawning and the group deactivates and a random other group (as described above) activates. Then when all the current enemies are destroyed the new group begins.

    But when ever i test it, the first group works but a new group does not proceed and i am not sure why...?

    Capx file:

    http://www.tilleydesign.co.uk/capx/EnergyFlux.capx

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