Page 1 of 1
Resized
Posted: Sat Mar 04, 2017 1:09 am
by bgordebak
Here's my prototype for March 4th. The theme was "Escalation". Any feedback is welcome.
In the game you score up when you reach the yellow box. Touching red circles kills you. You can change your size by using w and s keys. The bigger you're, the slower you move and vice versa. At maximum size you stop.
Since the positions of the red circles are randomly generated, sometimes it's easy, sometimes it's hard. You try to reach your maximum score.
EDIT: I don't think I came up with the best idea for this mechanic. Do you have any suggestions?
Update: Every even level is vertical now
Re: Resized
Posted: Mon Mar 13, 2017 5:15 am
by mtdev
I enjoyed it. Mechanics seem fine.
What is the reason for the multiple randoms in love.load()?
Code: Select all
math.random(); math.random(); math.random()
Re: Resized
Posted: Mon Mar 13, 2017 5:18 am
by bgordebak
mtdev wrote: ↑Mon Mar 13, 2017 5:15 am
I enjoyed it. Mechanics seem fine.
What is the reason for the multiple randoms in love.load()?
Code: Select all
math.random(); math.random(); math.random()
Thanks a lot!
I read somewhere that the first math.random() in lua isn't random, so you need to use it at least once to get a really random number after that. I saw someone put three to be on the safe side. I don't know the reason, but I like to be on the safe side.
Re: Resized
Posted: Mon Mar 13, 2017 5:37 am
by zorg
bgordebak wrote: ↑Mon Mar 13, 2017 5:18 am
mtdev wrote: ↑Mon Mar 13, 2017 5:15 am
I enjoyed it. Mechanics seem fine.
What is the reason for the multiple randoms in love.load()?
Code: Select all
math.random(); math.random(); math.random()
Thanks a lot!
I read somewhere that the first math.random() in lua isn't random, so you need to use it at least once to get a really random number after that. I saw someone put three to be on the safe side. I don't know the reason, but I like to be on the safe side.
Yes, it may or may not give back a "random enough" first value, depending on many factors. That's why it doesn't hurt to call it a few times.
However, one of those factors is OS-dependence, or in other words, lua's (including luajit too, probably) random generator will most likely give back different results on different OS-es (and/or architectures, even).
A good reason why löve has received
its own random generator stuff in 0.9.0; it'll give back the same numbers on all platforms.
People should use that instead of math.random.
(Also, only love's is seeded in love.run on startup, meaning you'll probably always get back the same numbers on each restart if you're not seeding lua's random generator yourself)
Re: Resized
Posted: Mon Mar 13, 2017 5:40 am
by bgordebak
Thanks zorg, I didn't know that LÖVE has its own random generator.
I always used math.random() by seeding with os.time(). But from now on I'll use LÖVE's.
Re: Resized
Posted: Mon Mar 13, 2017 6:03 am
by mtdev
Thank you both for the knowledge.