Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


rubber-chickenrubber-chicken Posts: 12Member
edited 12:08AM in Working with GS (Mac)

Im new to this so can anyone help me.

Im making a game where you have to collect the falling items, I have the items falling, but how can i randomise this so they dont all fall at the same time. Also, How can i play an animation when these items hit the ground, kind of like a splat?



  • JGary321JGary321 Posts: 1,246Member
    I'll try to help with the falling part, when I get home tonight (don't have time right now)

    But for the animation part: Make the ground an actor. When (falling actor) collides with (ground actor) play animation.
  • rubber-chickenrubber-chicken Posts: 12Member
    thanks but how do i get the falling object to stop falling so it plays the animation then dies??
  • quantumsheepquantumsheep Posts: 8,188Member
    Make a new actor and call it 'splat'.

    drag a timer behaviour across to it and set it FOR 2 seconds (or however long the animation lasts).

    drag an animation behaviour and put it into the timer. Put your animations images in here.

    drag another timer behaviour across and set it to AFTER 2 seconds (the length of your animation)

    drag a 'destroy actor' behaviour and put it in this second timer.

    Now make a new rule in your falling object actor.

    Have it say 'When attribute changes - self position y - is less than 20 (or whatever height the ground is at)

    Add the behaviour 'spawn actor' and tell it to spawn the 'splat' actor.

    Then add the behaviour 'destroy this actor'.

    That should do it. Essentially, when your falling object reaches a certain height it will spawn the splat actor and destroy itself. Then the splat actor will animate and destroy itself too.

    Hope that helps,


    Dr. Sam Beckett never returned home...

  • rubber-chickenrubber-chicken Posts: 12Member
    that worked great :)

    JGary321 you had any luck with the random function??

    Thanks Guys
  • JGary321JGary321 Posts: 1,246Member
    For Randomness:

    In my game I had an actor called "Mob Spawn". As the name suggests it would spawn a mob. (monster). The higher the level the tougher the enemies I threw in. It was random, kinda like what you wanna achieve.

    I made an Actor.Attribute called Mob Spawned. Each round I had a random attribute pick a number between 1-5 & store it in this attribute.

    I had my 5 different Mobs listed under 5 separate rules. For example I had

    If Actor.Mob Spawned = 1 Spawn Mob1 (this of course is referring to a separate actor named Mob1)

    If Actor.Mob Spawned = 2 Spawn Mob2


    So in your game just substitute Mob for items. Create an Item Spawner. Every "round" or x amount of seconds if based on a timer, select random number 1-(however many different items you have) Then create different rules for each item, saying if # = 1 then spawn actor (named of actor).

    I don't know of a more efficient way of doing it, but would be glad to listen to any other advice. Hope this helps.
This discussion has been closed.