[Solved] "Random" Bug

0 favourites
  • 3 posts
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • Hello there, before we begin:

    Windows 7 Ultimate

    32-bit Operating System

    Intel(R) Celeron(R) CPU E1400 2.00 GHz

    2.00 GB RAM (Memory)

    Display: NVIDEA GeForce GT 430

    I added a variable to a sprite (my enemy in the game) called "BulletChoice" and it starts off at 0. in the events I added an event that says:

    * If enemy.BulletChoice = 0 Then:

    * - Set enemy.BulletChoice To ("Random(1, 2)")

    The combinations I've tried:

    Random(1, 2)

    Random(3)

    Random(0, 2)

    Random(0, 3)

    Random(1, 3)

    Random(1, 2)

    Random(2)

    I'm tyying to get the value to choose 1 or 2 (later there will be more) but It doesn't choose any of those numbers it seems, I really don't know what happens there? :S

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You may want to try int(random(1,2)) which results will be either 1 or 2.

    Without the int(), your result is probably a float.

    If this is still not what you want/doesn't work as intended, can you post a capx showing the problem ?

    Also in the first line you write ("Random(1,2)"), did you write it like that in C2 too ?

    The ("") might indicate a string, which is not the correct variable type apparently and is not necessary.

  • You may want to try int(random(1,2)) which results will be either 1 or 2.

    Without the int(), your result is probably a float.

    If this is still not what you want/doesn't work as intended, can you post a capx showing the problem ?

    Also in the first line you write ("Random(1,2)"), did you write it like that in C2 too ?

    The ("") might indicate a string, which is not the correct variable type apparently and is not necessary.

    That worked like a charm, Thanks very much for that Kyatric!

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