User Tag List

Results 1 to 6 of 6

Thread: random value + another problem

  1. #1
    No Products Registered

    Join Date
    Oct 2007
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    random value + another problem

    Ok, Im not that good writing english, but I'll try...

    So I'm making Tetris like game and there is 6 different blocks. I want it so that every time block has been placed the next block will be chosen randomly. So I need to get random value between 1-6 and I dont know how to do it.

    Since there is no option like "set counter value to random" I*ve triend this: every 1/100s add 1 to counter and when counter value is 6 or more set it back to 1. If u press fire when the counter value is 1 then u will get block 1 or if the value is 2 u will get block 2 and so on... But there is problem with this, I can never get block 1 or 2, and with right timing I can always get the same block.

  2. #2
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: random value

    To get a random value, use this in the Expression editor:

    Code:
    random(x)
    where x is a value. This will give you a random number between 0 and (x-1), so to get a value between 1 and 6, you would use random(6) + 1.

  3. #3
    No Products Registered

    Join Date
    Oct 2007
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: random value

    Thanks! Ok, now I have another problem with the block movement... I want the blocks move like when u press left it moves 32 pixel left and if u press right it will move right, but only 32 pixels, no more or less, so normal 8 direction movement wont help. Ive tried to do this so that when I press arrow key it destroys the block and creates another next to the destroyed one. The only problem is that it will also teleport the block outside from play area or inside another block..

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Location
    Iceland
    Posts
    478
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: random value

    Hi

    I would look at this Extension
    http://clickteam.info/neatwares/extensions/ext/Advanced_Game_Board_Object

    Keli

  5. #5
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: random value

    what about

    +upon pressing right
    -set x position of box to x position of box+32
    and
    +upon pressing left
    -set x position of box to x position of box-32

  6. #6
    Clicker Multimedia Fusion 2

    Join Date
    May 2007
    Location
    NJ
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: random value

    Quote Originally Posted by Darkwing
    what about

    +upon pressing right
    -set x position of box to x position of box+32
    and
    +upon pressing left
    -set x position of box to x position of box-32
    Along with a collision with the edge of the frame.

    I believe you do so like this:

    +(object)Leaves the play area
    -Stop

    Hope that helps ^_^

Similar Threads

  1. Random displaying problem!
    By Radical in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 25th October 2013, 10:44 PM
  2. Random problem
    By dontknow in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 12th June 2011, 08:18 AM
  3. A random problem
    By Watermelon786 in forum File Archive
    Replies: 3
    Last Post: 2nd January 2011, 09:50 PM
  4. Random number problem
    By Bk90 in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 29th December 2009, 01:19 AM
  5. RANDOM problem
    By siriso in forum The Games Factory 2 - Technical Support
    Replies: 8
    Last Post: 8th October 2008, 08:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •