Walls!
Posted: Mon Nov 21, 2011 7:16 am
Hey I'm pretty new to game developement, but I am very determined. I hope you dont think im an annoying bastard because of thatXD
I am making a game and so far there is a EXETREMELY simple menu(not important right now..)
you push "return" and there is a red box (which you control with WASD and text in the top left saying "use the WASD keys to move!"
I'm obviously not gonna take this game to seriously, just hoping it could help me get into the programming shizdig:)
SO I NEED HELP WITH making a wall! or a solid object that the red box(the user) cant walk through, and i would prefer it not to be just boxes like in sidescrollers such as mario. maybe cheasy lines or something? anyways the MAIN POINT is i want a line, that the player cant walk through. I would really appreciate it if someone helped me!
and if you have any tips for newbies please tell me!:D
Here is my main.lua,
function love.draw()
love.graphics.print("Welcome! Press Enter To Start!:D", 180, 300)
love.graphics.setColor(255, 20, 20)
end
function love.keypressed(key)
if key == "return" then
function love.keypressed(key)
if key == "a" then x = x-5
elseif key == "d" then x = x+5
elseif key == "s" then y = y+5
elseif key == "w" then y = y-5
end
end
function love.draw()
love.graphics.draw( character, x, y)
love.graphics.print("Use the WASD keys to move!", 50, 50)
end
end
end
I set most of the variables inside of conf.lua which is..
function love.conf(t)
t.title = "Box Game!:D"
t.screen.width = 800
t.screen.height = 600
end
function love.load()
x = 400
love.keyboard.setKeyRepeat(10, 10)
love.graphics.setBackgroundColor(255, 255, 255)
love.graphics.setColor(20, 250, 20)
character = love.graphics.newImage("character.png")
love.graphics.setFont(28)
y = 300
end
THANKS!;D
I am making a game and so far there is a EXETREMELY simple menu(not important right now..)
you push "return" and there is a red box (which you control with WASD and text in the top left saying "use the WASD keys to move!"
I'm obviously not gonna take this game to seriously, just hoping it could help me get into the programming shizdig:)
SO I NEED HELP WITH making a wall! or a solid object that the red box(the user) cant walk through, and i would prefer it not to be just boxes like in sidescrollers such as mario. maybe cheasy lines or something? anyways the MAIN POINT is i want a line, that the player cant walk through. I would really appreciate it if someone helped me!
and if you have any tips for newbies please tell me!:D
Here is my main.lua,
function love.draw()
love.graphics.print("Welcome! Press Enter To Start!:D", 180, 300)
love.graphics.setColor(255, 20, 20)
end
function love.keypressed(key)
if key == "return" then
function love.keypressed(key)
if key == "a" then x = x-5
elseif key == "d" then x = x+5
elseif key == "s" then y = y+5
elseif key == "w" then y = y-5
end
end
function love.draw()
love.graphics.draw( character, x, y)
love.graphics.print("Use the WASD keys to move!", 50, 50)
end
end
end
I set most of the variables inside of conf.lua which is..
function love.conf(t)
t.title = "Box Game!:D"
t.screen.width = 800
t.screen.height = 600
end
function love.load()
x = 400
love.keyboard.setKeyRepeat(10, 10)
love.graphics.setBackgroundColor(255, 255, 255)
love.graphics.setColor(20, 250, 20)
character = love.graphics.newImage("character.png")
love.graphics.setFont(28)
y = 300
end
THANKS!;D