Issue with a randomly state

0 favourites
  • 7 posts
From the Asset Store
State Machine
$10.99 USD
State Machine is a great tool for managing the state of anything in your game.
  • Hello everyone, <img src="smileys/smiley2.gif" border="0" align="middle" />

    I am currently testing a prototype board game. But I have a problem with an Instance variable (water.drop) that I would like to load it on start of layout, randomly initializing between 3 states possible (0, 1 or 2). But it doesn't work. And I don't know where it comes from.

    When i run the game all the drops of water are in the same state (0).

    Here my prototype file:

    dl.dropbox.com/s/szoyxxnm0iinl13/ProtoWaterDrop.capx

    Hope you can help me out!

    Thanks

    Aktarus

    ps: I don't speak English very well, so sorry!

  • There are some plugin dependencies in the capx so posting screenshot of the troublesome events might be a good idea as well :)

  • Not 100% sure but I think creating the water with chess plugin does not pick the created instance, unlike creating it with one of the build in functions would.

    Solution would be to add event:

    Water On Created

         Set drop to floor(random(0..3))

    You got fun start for a game there by the way :)

  • Very good! And thanks Vee41.

    It works very well! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why not use choose(0,1,2,3)

    I guess things like floor, int, random would work but choose is the most logical choice (Even though it would do the exact same thing)

    Using floor(random(0,3)) actually will (almost) never get you 3. Since it chooses a huge range of decimal points, there's thousands of possibilities between 2 and 3. The likelihood of getting 3 is quite slim so you could use choose() OR you could do round(random())

  • Yes, you right EncriptedCow.

    I use now choose(0,1,2)

    Thanks

    <img src="smileys/smiley2.gif" border="0" align="middle" />

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