Random not being Random
brett-norton
Member, BASIC Posts: 64
Hey all,
Anyone know why my random spawner not playing nicely?
I have a timer set to random 1, 3 seconds run to completion checked and it seems to be stuck spawning on the same number.
the objects being spawned have the following code in them, but noted that when trying to spawn an empty character it also does the same.
Code in the actor being spawned is-
Constrain - Self.pos.x to 100cos(self.time75%360)+game.EarthX
Constrain - Self.pos.x to 100sin(self.time75%360)+game.EarthX)
Constrain - VectorToAngle(game.eartyX-self.positionX,game.earthY-self.positionY)
Thanks
Comments
If you use an Every Timer in GameSalad, such as this...
Timer every random(1,3) seconds
...the expression is evaluated once (so either 1, 2, or 3) and then that value is used for each cycle of the timer. What you need is a custom-interval timer like this:
http://forums.gamesalad.com/discussion/comment/464547/#Comment_464547
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
As an aside, Vanilla Forums software converts text surrounded by asterisks (*) to italics and removes the asterisks. Lovely, right? To avoid that, add a space before and after each asterisk:
100 * sin
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
. . . . or you can add a ` on either side . . . . .
Like
*
this*
.That code looks wrong to me, is it meant make the actor orbit around earth.X / earth.Y at a radius of 100 pixels ?
If so then it should read . . .
That's - no bracket after Earth.Y / second constrain should be Y rather than X.
you can further slim it down to . . .