Hi, I am just finishing up my first gridlocked "maze game" How can i make "exit" (draw image or just play sound)
or change map when player reaches "exit grid" (which has value 2) ?
map1 = {
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 },
{ 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1 },
{ 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1 },
{ 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1 },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1 },
}
-Thanks in advance.
https://www.love2d.org/wiki/Tutorial:Gridlocked_Player
Gridlocked maze game[solved]
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Gridlocked maze game[solved]
Last edited by zhaska on Sun Apr 07, 2013 7:54 pm, edited 2 times in total.
Level 2 dynamic scrambler.
Re: Gridlocked maze game/.help needed
If i understood your questions right, Here's how to do those things.
To make the game exit you call this:
You could put this under love.keypressed so the game closes when you press escape or something like that.
To change the map when the player enters the 2 tile isn't too hard either, I could help you more if you showed me your .love file though.
But basically you first figure out what tile the player is on, Then you check if said tile is the type "2", If it is you change the map.
To make the game exit you call this:
Code: Select all
love.event.push("quit")
To change the map when the player enters the 2 tile isn't too hard either, I could help you more if you showed me your .love file though.
But basically you first figure out what tile the player is on, Then you check if said tile is the type "2", If it is you change the map.
Re: Gridlocked maze game/.help needed
My point was how to make a code that detects player's presence in grid which has value of 2 and prints out pic and plays a sound
for example ..
if "player location value" == 2 then
love.audio.play(bgm2)
love.graphics.draw(image2 0, 0)
end
p.s please mute your sounds if you decide to run the program.
for example ..
if "player location value" == 2 then
love.audio.play(bgm2)
love.graphics.draw(image2 0, 0)
end
p.s please mute your sounds if you decide to run the program.
Last edited by zhaska on Sun Apr 07, 2013 7:56 pm, edited 2 times in total.
Level 2 dynamic scrambler.
Re: Gridlocked maze game/.help needed
It seems like that tutorial gives you exactly what you need.
Change that to:
Code: Select all
function testMap(x, y)
if map[(player.grid_y / 32) + y][(player.grid_x / 32) + x] == 1 then
return false
end
return true
end
Code: Select all
function testMap(x, y)
if map[(player.grid_y / 32) + y][(player.grid_x / 32) + x] == 2 then
love.audio.play(bgm2)
love.graphics.draw(image2, 0, 0)
end
return true
end
Re: Gridlocked maze game /CaseClosed
Damn .. the answer was just right front of me. Thanks for the info : D
Level 2 dynamic scrambler.
Who is online
Users browsing this forum: Bing [Bot] and 11 guests