How do I randomise the characters and where they pop up?

0 favourites
  • 14 posts
From the Asset Store
Relax and relieve stress by popping bubbles in Fidget Anti- Stress Releaser!
  • Hi Guys,

    I'm having a bit of trouble with a 'Whack A Mole' style game.

    There are 9 windows where i plan to have the characters appear from.

    I want to use 15 different characters and for them to randomly appear in different windows. (from below)

    Currently i have 9 characters below the windows and they pop up randomly but the same character always pops up below the same window.

    Any help would be really appreciated.

  • I'm only still a beginner but I would suggest to place all the characters in an animation frame, each with its own frame number.

    Then you have C2 select a random frame every x seconds, on a button click, on start of layout or whatever.

    Like so:

  • Brilliant cheers Rjan,

    That has randomised them appearing however when just using 3 different characters some of the same character appears twice coming out of two different windows. How can i adjust this so that a character will only show out of one window at a time ?

    Hope this makes sense, if it doesn't i can try and explained better.

  • Yep, it does make sense, but I'll have to think about this one.

    Maybe other forum members have the answer right away?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That would be great.

    I assume it needs an action so that when x is visible then do not repeat that number , but don't know how to apply this in construct

  • An array would help you with assigning unique animation frames to your sprites. Something like the attached file should work.

  • An array would help you with assigning unique animation frames to your sprites. Something like the attached file should work.

    Thanks Magistross, I have had a look at your file and we haven't used arrays. I've attached the capx file of ours (the characters used are just placeholders at the moment) can you take a look and see if we are doing this a silly way, and if using arrays is easier... We want the characters to pop up and not repeat themselves whilst the same character is still visible.

    Any other people willing to help would be great... cheers

  • Bump

  • Someone must know! Check out the xcap please

  • I have been facing the same issue before and the only way I found to do it is to use an array. You store all the possible values the random can pick from into an array, and remove a value when it's picked. Then you can reinitilialise the array between rounds or levels so that all values are back into it and can be picked again.

  • ,,,,

  • ,,,,

    Hi Mate, you used a plugin called spritefont + which i cant seem to locate, can you help me out? Cheers

  • Try now... I deleted spritefont..

    Spritefont+

  • Try now... I deleted spritefont..

    Spritefont+

    Thanks man really appreciate your fast reply.

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