Page 1 of 1
Some questions
Posted: Fri Oct 12, 2012 10:33 pm
by PedroChurro
So, I thought, I have so many questions, and I really don't want to spam the forums, so, can I post the questions I have on this topic? It would be really useful.
Here are some questions to start:
1: So, I'm already trying to make a game, and I'm currently doing the menu. But there is one problem, I have a background I want to use for the menu, but when I use it, it covers up the buttons(Start, quit, etc.). How can I change that?
2:How can I make my character to jump, and do a small animation when walking?
3:The tutorials I followed didn't cover how to make text with a custom font. What's the code for that?
Sorry for being such a noob.
Re: Some questions
Posted: Fri Oct 12, 2012 10:44 pm
by paritybit
Drawing order matters. What you draw last is on top. So, you want to draw the background first and the buttons last.
Animations are a more difficult subject, since you're new to this you probably want to use an existing library like
anim8. But the very basics are that you want to have a bunch of images that are played in sequence so that it looks like your character is doing some action.
Re: Some questions
Posted: Fri Oct 12, 2012 10:49 pm
by PedroChurro
paritybit wrote:Drawing order matters. What you draw last is on top. So, you want to draw the background first and the buttons last.
Animations are a more difficult subject, since you're new to this you probably want to use an existing library like
anim8. But the very basics are that you want to have a bunch of images that are played in sequence so that it looks like your character is doing some action.
Thanks, and also, yes, that is what I was planning to do, "have a bunch of images that are playing in sequence". But I don't know how to code that.
Re: Some questions
Posted: Fri Oct 12, 2012 10:58 pm
by paritybit
PedroChurro wrote:But I don't know how to code that.
Take a look at anim8 (linked in the original response); it's a library for doing that and the tutorials will probably help.
Re: Some questions
Posted: Sat Oct 13, 2012 2:46 am
by Nsmurf
This might be a bit hard for a beginner, but for a simple animation system, you could do something like this:
Code: Select all
anm = {love.graphics.newImage('lol1.png'), love.graphics.newImage('lol2.png')}
anmon = 1
function love.update(dt)
if anmon < table.getn(anm) then
anmon = anmon + 1*dt
else
anmon = 1
end
end
function love.draw()
love.graphics.draw(anm[round(anmon)])
end
function round(n, deci) deci = 10^(deci or 0) return math.floor(n*deci+.5)/deci end
However, I DO NOT suggest that you use this. To start off with, I would suggest that you use something like
anim8, or the newly created
MASH.
See this tutorial for fonts.
It's a bit confuzzling, and probably to complex for what you want, but you could use
this for drawing order.
Good luck with your game
Re: Some questions
Posted: Sat Oct 13, 2012 6:41 am
by substitute541
Answer no. 1 : Drawing order matters. What's at the bottom goes at the front of everything else.
Answer no. 2 : Either try ready-made libraries, or just look at the wiki
Answer no. 3 :
https://love2d.org/wiki/love.font
Re: Some questions
Posted: Sat Oct 13, 2012 2:01 pm
by PedroChurro
Thanks, I think I'll try anim8.