So for example I have 10 different maps in a map.lua file. They look like this:
1111
1001
1001
1111
0 - floor tile
1 - wall
i need to choose 1 random room from a list at the start of the game.
How to choose renadom map from a list?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: How to choose renadom map from a list?
if you have an array of tables, like
then you can just
Code: Select all
rooms = {}
rooms[1] = { -- room code }
-- etc...
Code: Select all
selectedroom = rooms[math.love.random(#rooms)]
Re: How to choose renadom map from a list?
should benuno wrote:Code: Select all
selectedroom = rooms[math.love.random(#rooms)]
Code: Select all
selectedroom = rooms[love.math.random(#rooms)]
Who is online
Users browsing this forum: Amazon [Bot], Bing [Bot], Google [Bot], Semrush [Bot] and 3 guests