Help out a beginner (spawning objects)
- DaedalusYoung
- Party member
- Posts: 413
- Joined: Sun Jul 14, 2013 8:04 pm
Re: Help out a beginner (spawning objects)
Also, enemyImage is not declared.
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Help out a beginner (spawning objects)
I think love.math.random allows you to have more than one set of random seeds for different purposes. Much like how Minecraft uses one seed for world generation, but a different one for placement of enemies and other randomness. They have to be kept separate for obvious reasons. The world seed must remain constant, but if the rest of the random stuff used the same seed then all the stuff happening inside the world would always be the same, which wouldn't be what you want.Davidobot wrote:You can just use math.random?ThatTreeOverThere wrote:In Love 0.9.0, you can use love.math.random to generate a random number.
In other versions, you'll have to use something like this: http://stackoverflow.com/questions/1868 ... -generator
At least that's what I think love.math.random is for.
- slime
- Solid Snayke
- Posts: 3162
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Help out a beginner (spawning objects)
The love.math.random function exists partly because math.random's implementation is different on different operating systems. love.math.random will give the same results regardless of OS, given the same inputs (if the random seed/state is the same), but math.random will not.Jasoco wrote:I think love.math.random allows you to have more than one set of random seeds for different purposes. Much like how Minecraft uses one seed for world generation, but a different one for placement of enemies and other randomness. They have to be kept separate for obvious reasons. The world seed must remain constant, but if the rest of the random stuff used the same seed then all the stuff happening inside the world would always be the same, which wouldn't be what you want.
At least that's what I think love.math.random is for.
love.math also has RandomGenerator objects for having multiple concurrent random states.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests