Spawn patterns?

Hi everyone!
Sorry for the bad graphics (I'm at work). I want to spawn raindrops from 5 separate clouds in different patterns. Like just the two from the left, the middle and last cloud or all but one etc. Which is the best way to achieve this?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Are the clouds stationary? If not, do they move as a group or individually at different speeds/times?

    What type of pattern are you envisioning? I don't understand this:

    @GreenfroggGames said:
    Like just the two from the left, the middle and last cloud or all but one etc.

    Are you wanting set patterns that cycle through or more randomness?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • GreenfroggGamesGreenfroggGames Member Posts: 224

    @tatiang Clouds are stationary. I want it to be random with set patterns I guess. For example I want them to spawn like an arrow or starting from the left going right at random

  • imjustmikeimjustmike Member Posts: 450

    It depends if you want to spawn them randomly (with a chance of spawning) or based on a pattern.

    If the first (i.e randomly) , create a global integer attribute called global.spawn. In an actor create a timer that changes global.spawn to random(1,5) every 1 seconds. In the cloud actors create a self attribute called self.random. Add a change attribute behaviour that changes self.random to random(1,5). Then create a rule in that actor that says if self.random = global.spawn then spawn arrow actor. Then you can play around with the variables to create the effect you want.

    For the latter you could use a table. Create column for each cloud, and a row for each combination, with 1 or 0 in the cells. In the cloud actor create a self attribute called cloud id - you will use this later to reference the table cells.

    Create a global integer attribute called spawn.

    Have a timer change global.spawn to 1 every X seconds, where x is the frequency you want to spawn at (could also be an attribute).

    Then use rules to determine if the actor should spawn based on the table reference.

  • antleecarantleecar Member, PRO Posts: 8

    By your illustration and description, you can have say 5 patterns, define it by game.pattern. in the spawn actor of the patterns, created 5 rules for each pattern. If game.patterns = 1, spawn actor drop at xy position of cloud 1 and spawn actor drop at xy position of cloud 3. If game.pattern= 3, spawn drop at xy position of cloud 4, so on and so forth. Then set a timer to change values every how many seconds you want a pattern to be spawned. (or don't use a timer if you don't wanna be a chump!)

  • GreenfroggGamesGreenfroggGames Member Posts: 224

    @imjustmike @antleecar thank you for your replies :) I think I'll give tables a shot

Sign In or Register to comment.