starting to development a game [solved]

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
bobbymcbobface
Citizen
Posts: 78
Joined: Tue Jun 04, 2019 8:31 pm

starting to development a game [solved]

Post by bobbymcbobface »

Haya i'm a noob to these forums so soz if i get something wrong but
so i just want to know if anyone could show me an example of animated sprite that can jump and walk with the code so i can test around with it and learn how it's done to use in any games i want to make

ty ☺ :awesome: :awesome: :awesome: :awesome: :awesome:
Last edited by bobbymcbobface on Fri Jun 28, 2019 5:14 pm, edited 1 time in total.
I make games that run on potatoes :P
TheHUG
Citizen
Posts: 61
Joined: Sun Apr 01, 2018 4:21 pm

Re: starting to development a game

Post by TheHUG »

I don't have any of my own on hand, but I can point you to two tutorials with examples :
https://love2d.org/wiki/Tutorial:Animation
https://www.gamefromscratch.com/post/20 ... orial.aspx
MrFariator
Party member
Posts: 509
Joined: Wed Oct 05, 2016 11:53 am

Re: starting to development a game

Post by MrFariator »

Sheepolution's tutorial covers animated sprites and then some.
User avatar
bobbymcbobface
Citizen
Posts: 78
Joined: Tue Jun 04, 2019 8:31 pm

Re: starting to development a game

Post by bobbymcbobface »

Thanks guys this is Really helpfull!
I make games that run on potatoes :P
User avatar
bobbymcbobface
Citizen
Posts: 78
Joined: Tue Jun 04, 2019 8:31 pm

Re: starting to development a game

Post by bobbymcbobface »

:P Sorry to be be a pain in the A** but the problem i'm having is although i know how to do animations how do i turn that into a moving sprite?
(sorry about the double post btw)
I make games that run on potatoes :P
TheHUG
Citizen
Posts: 61
Joined: Sun Apr 01, 2018 4:21 pm

Re: starting to development a game

Post by TheHUG »

No problem. In the tutorials love.graphics.draw is called to render the sprite. https://love2d.org/wiki/love.graphics.draw , As you can see in the documentation, the second and third arguments (after the drawable) are the x and y position at which to draw. So to move the sprite you just change the numbers you provide there. You can store the position of your object and just provide that position to the function.
quick example :

Code: Select all

love.load()
   anobj = {x=100, y=100, sprite=<your-sprite-here>, speed=10}
end
function love.draw()
    love.graphics.draw(anobj.sprite, anobj.x, anobj.y)
end

function love.update(dt)
   if love.keyboard.isDown('up') then
        anobj.y = anobj.y - (speed * dt)
   end
   -- ... and so on
end
User avatar
bobbymcbobface
Citizen
Posts: 78
Joined: Tue Jun 04, 2019 8:31 pm

Re: starting to development a game

Post by bobbymcbobface »

:awesome: Thank you so much you've all been a massive help!
I make games that run on potatoes :P
Post Reply

Who is online

Users browsing this forum: No registered users and 63 guests