Random numbers for A,B,C,D,E... no identical digit
Hi all,
So a few days ago I wrote a post regarding thoughts I had on my gamesalad experience .
I gave example of my struggle generating a random numbers solution, today I saw another post on this issue and thought I'll post my solution maybe it could help someone.
My way:
On game:
create 5 (or as many as you need) integer Attributes (name them 1,2,3,4,5)
create 1 actor
on the actor:
create rule: actor receives: touch: is pressed
change attributes: game.1 To game.2
create a timer (not inside the first rule)
every 0 sec
create a rule: when any:
attributes: game.1 = game.2
attributes: game.1 = game.3
attributes: game.1 = game.4
attributes: game.1 = game.5
attributes: game.2 = game.3
attributes: game.2 = game.4
attributes: game.2 = game.5
attributes: game.3 = game.4
attributes: game.3 = game.5
attributes: game.4 = game.5
change attributes: game.1 To random(1,5)
change attributes: game.2 To random(1,5)
change attributes: game.3 To random(1,5)
change attributes: game.4 To random(1,5)
change attributes: game.5 To random(1,5)
That's it, very easy to had digits.
But it can take a sec or two to generat all the digits.
Best regardes
Alex
So a few days ago I wrote a post regarding thoughts I had on my gamesalad experience .
I gave example of my struggle generating a random numbers solution, today I saw another post on this issue and thought I'll post my solution maybe it could help someone.
My way:
On game:
create 5 (or as many as you need) integer Attributes (name them 1,2,3,4,5)
create 1 actor
on the actor:
create rule: actor receives: touch: is pressed
change attributes: game.1 To game.2
create a timer (not inside the first rule)
every 0 sec
create a rule: when any:
attributes: game.1 = game.2
attributes: game.1 = game.3
attributes: game.1 = game.4
attributes: game.1 = game.5
attributes: game.2 = game.3
attributes: game.2 = game.4
attributes: game.2 = game.5
attributes: game.3 = game.4
attributes: game.3 = game.5
attributes: game.4 = game.5
change attributes: game.1 To random(1,5)
change attributes: game.2 To random(1,5)
change attributes: game.3 To random(1,5)
change attributes: game.4 To random(1,5)
change attributes: game.5 To random(1,5)
That's it, very easy to had digits.
But it can take a sec or two to generat all the digits.
Best regardes
Alex
Comments
You can do it this way, but I'm not exactly sure but the more rules you use the more like of the processor you use causing larger load times.
Matt