Page 1 of 1
My Own Tile Based Game
Posted: Sat Apr 23, 2016 8:58 am
by steVeRoll
It has walls, keys, lasers, switches... Uh... That's pretty much it. (And boxes, but they don't fully work yet)
Use the arrow keys to move. Collect all of the keys in the level to open the exit, then touch the exit to go to the next level. There might be lasers blocking your way, but you can disable them with their corresponding switch. To use a switch, walk over it and press [A].
Re: My Own Tile Based Game
Posted: Sat Apr 23, 2016 3:43 pm
by Skeiks
Well done so far, a couple of things though.
Could you make it so you can hold down a direction to keep moving in that direction? Having to press the arrow keys multiple times gets very tedious after a while.
When you're designing puzzles, if you go further with the game, I suggest making some switches activate more than one component. And also adding a switch type that activates as you pass through it, as opposed to when you press a button standing on it.
Re: My Own Tile Based Game
Posted: Sun Apr 24, 2016 8:06 am
by steVeRoll
Skeiks wrote:Well done so far, a couple of things though.
Could you make it so you can hold down a direction to keep moving in that direction? Having to press the arrow keys multiple times gets very tedious after a while.
When you're designing puzzles, if you go further with the game, I suggest making some switches activate more than one component. And also adding a switch type that activates as you pass through it, as opposed to when you press a button standing on it.
Thank you for your feedback, Skeiks! I'll try to implement all you said.
I could finish making these boxes and use them with the stand-on button mechanic you mentioned.
Again, thank you!
Re: My Own Tile Based Game
Posted: Sun Apr 24, 2016 12:52 pm
by Xugro
Works nicely.
I just looked at the code and noticed two things:
- You reload a lot of images every time you use them. Just load them in love.load() and use them when you need them. You could use something like this:
Code: Select all
function love.load()
-- load all images once and save them
player.image["up"] = love.graphics.newImage("assets/player_up.png")
player.image["down"] = love.graphics.newImage("assets/player_down.png")
player.image["left"] = love.graphics.newImage("assets/player_left.png")
player.image["right"] = love.graphics.newImage("assets/player_right.png")
-- set starting direction
player.lastDirection = "down"
end
function love.draw()
-- just draw the appropriate image
love.graphics.draw(player.image[player.lastDirection], (player.x-1)*blockSize, (player.y-1)*blockSize)
end
- Every time you load a level for every tile-type you look at every position. You could just look at every position once and then decide what do to with it - e.g.:
Code: Select all
function load_level()
for i=1,arrWidth do
for j=1,arrHeight do
if currLvlArr[i][j] == 3 then
position_player(i,j)
elseif currLvlArr[i][j] == 4 then
generate_key(i,j)
elseif
-- and so on
end
end
end
end