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
Walls!
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- baconhawka7x
- Party member
- Posts: 491
- Joined: Mon Nov 21, 2011 7:05 am
- Location: Oregon, USA
- Contact:
Re: Walls!
Hello and welcome to the LOVE community. When posting on the board please surround any code clipping with
Code: Select all
tags.
[quote]SO I NEED HELP WITH making a wall! or a solid object that the red box(the user) cant walk through[/quote]
You're going to need some collision detection for this. Try [url=http://vrld.github.com/HardonCollider/]Hardon Collider[/url].
[quote]I set most of the variables inside of conf.lua which is..[/quote]
The conf file should really only be for configuring love. It's better if you put the love.load declaration in the main.lua file.
Re: Walls!
You cant use more then once love.draw(), is not a function that has to be looped by you, löve itself does that already.
So, what your basic game main.lua should look like is like this :
So, what your basic game main.lua should look like is like this :
Code: Select all
function love.load()
--stuff
end
function love.update()
--stuff
end
function love.draw()
--stuff
end
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Walls!
Actually, if you look carefully you'll see that what he does sort of works. It's by no way a good idea, though, in that you're definitely right.GijsB wrote:You cant use more then once love.draw(), is not a function that has to be looped by you, löve itself does that already.
Help us help you: attach a .love.
- baconhawka7x
- Party member
- Posts: 491
- Joined: Mon Nov 21, 2011 7:05 am
- Location: Oregon, USA
- Contact:
Re: Walls!
Kadoba wrote:Hello and welcome to the LOVE community. When posting on the board please surround any code clipping withCode: Select all
tags.[quote][/quote][/quote] Thank you that helps alot [quote]The conf file should really only be for configuring love. It's better if you put the love.load declaration in the main.lua file[quote][/quote][/quote] ok! ill keep that in mind! thank yew!:D
- baconhawka7x
- Party member
- Posts: 491
- Joined: Mon Nov 21, 2011 7:05 am
- Location: Oregon, USA
- Contact:
Re: Walls!
omg thank you SOO much !:DGijsB wrote:You cant use more then once love.draw(), is not a function that has to be looped by you, löve itself does that already.
So, what your basic game main.lua should look like is like this :
Code: Select all
function love.load() --stuff end function love.update() --stuff end function love.draw() --stuff end
Re: Walls!
Depends on the lines you want, I think the best way to learn how collision works is to use Bounding Box collision, then maybe try and understand some more complicated collision checking methods. Bounding box is probably the simplest collision detection, as it can only detect collisions between rectangular shapes.
If you want something more complicated look into HardonCollider.
If you want something more complicated look into HardonCollider.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 51 guests