Spawn only even numbers

DisimobDisimob Member, PRO Posts: 32

Hi
I d like to spawn actor that diplay only even numbers.
Could u help me.
Thanks
Simone

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited June 2015

    Might need more details.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Here's one two.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • CaptFinnCaptFinn Member Posts: 1,828

    Depending on what and why you need it and how youre implementing the numbers in the game. But with Rules and Behaviors, this shouldnt be a problem at all. Heck using tables is a possibility.

  • DisimobDisimob Member, PRO Posts: 32

    thanks tating for demo!

    it's better if I give you more details guys.
    I have two actors; each one spawn random numbers and I have to do a division (first actor / the second) and result has to be an integer number not float like for example 2.67.
    For sure the first one has to be bigger then second (at least the same value). This i the reason why I asked for even numbers.
    Hoping my description is clear, I thanks for your time!!

  • SocksSocks London, UK.Member Posts: 12,822

    @Disimob said:
    For sure the first one has to be bigger then second (at least the same value).

    If they are the same value, the result will always be 1, 1 is not an even number.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @Socks I think @Disimob wants to choose two random even integers that when divided (large÷small) equal an integer. But the result doesn't have to be even.

    @Disimob is that accurate? And why not provide that info in the first post? ;)

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    If you are creating a math practice game, there is an easier way to always get the answer to be an integer.

    First, randomly generate the answer.
    Then, randomly generate the second number.
    Then, to get the first number, multiply the second number by the answer.

    Example:
    Answer = 5 (randomly generated)
    2ndNum = 3 (randomly generated)
    1stNum = 5*3 = 15

    Then present the game problem:
    15 / 3 = ?

    Answer = 5

  • SocksSocks London, UK.Member Posts: 12,822

    @tatiang said:
    And why not provide that info in the first post? ;)

    Too easy.

  • DisimobDisimob Member, PRO Posts: 32

    Hi eversione
    Sorry U got reason. I Had r
    To give you more info

  • DisimobDisimob Member, PRO Posts: 32

    .... Could you give a real example?? I promise it is my Last request

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Here you go.

  • DisimobDisimob Member, PRO Posts: 32

    Thannnksssss

Sign In or Register to comment.