Latest Release: Random Sucks?
mangasprai
Member, PRO Posts: 35
Hello guys, i don't know whats happening,the fact is that, as far i tried, in the new game salad, random function just sucks (maybe?).
Okay: i have this fire ball that starts at random Y position.
Then, while traveling trough the screen with linear motion X, its Y position interpolate to random again ---> random(150,340).
BUT
whenever it tries to do that random goes like this
150... 151... 152.... 155..... 157....
like that. Not random at all. it destroys the gameplay. Any idea about this?
note that every time it's destroyed and respawned so it's a totally new actor each time..
Comments
My guess would be that you're trying to Interpolate too quickly, or rather too often.
What happens if you try a Timer set to every 0.5 seconds (not in a rule) with a Log Debugging Statement with the expression random(150,340)?
Here are my results:
Log(Actor: Actor 1): 222 Log(Actor: Actor 1): 199 Log(Actor: Actor 1): 214 Log(Actor: Actor 1): 289 Log(Actor: Actor 1): 204 Log(Actor: Actor 1): 200 Log(Actor: Actor 1): 259 Log(Actor: Actor 1): 187 Log(Actor: Actor 1): 254 Log(Actor: Actor 1): 192
Looks pretty random. If that works for you, then what is it about your rule for interpolating that is causing the problem? Maybe try changing an attribute to random(150,340) and then interpolating to that attribute instead? Anyway, if you can't figure it out, post a screenshot of your rule.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
In fact, check out this simple demo that refreshes the position every second: https://www.dropbox.com/s/29xdcxtqshxq78b/random Y.zip.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Found the problem:
i was using the game reset (the little icon with the arrow that rotates next the pause) instead of accessing the scene each time to test the randomness, and looks like the first randomness "shot" is not that random, in fact now that i am accessing the scene each time it gives random values. Same if i do a timed respawn as you did. Strange. But at least is resolved
See be cautious before labeling anything a bug or GS issue. Too many people jump to that conclusion to often instead of asking, what am I doing wrong.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS