Page 3 of 5

Re: examples.love

Posted: Wed Feb 10, 2016 9:11 pm
by monolifed
I got the wheel working with viewer
I might try to add love2d reference but probably not a good idea
Edit: I noticed that the animation example is flickering and the sample image is too small
Edit: animation example could have been simpler

Code: Select all

function love.load()
	image = love.graphics.newImage("assets/anim-boogie.png")
	local sw, sh = image:getDimensions()
	frames = {
		love.graphics.newQuad( 0,  0, 32, 32, sw, sh),
		love.graphics.newQuad(32,  0, 32, 32, sw, sh),
		love.graphics.newQuad(64,  0, 32, 32, sw, sh),
		love.graphics.newQuad( 0, 32, 32, 32, sw, sh),
		love.graphics.newQuad(32, 32, 32, 32, sw, sh),
		love.graphics.newQuad(64, 32, 32, 32, sw, sh)
	}
	frameindex = 1
	time = 0
end

function love.draw()
	love.graphics.draw(image, frames[frameindex], 100, 100)
end

function love.update(dt)
	time = time + dt
	frameindex = math.floor(time * 10) % #frames + 1
end
I think some of the examples could be pushed downwards and simpler versions of those can be added

Re: examples.love

Posted: Thu Feb 11, 2016 11:45 am
by Megadardery
I think we should add two versions of the animation, one simple like yours, and one complicated using AnAL. I have an idea for the complicated one that could be extremely helpful for people seeking help, that is an idle animation that can be changed into a jump animation if the player actually jumps. That would need an additional example of how to implement basic jump in the first place, but oh well.

Re: examples.love

Posted: Thu Feb 11, 2016 9:59 pm
by bobbyjones
probably should use anim8. AnAL is outdated I don't even understand how people are still using it.

Re: examples.love

Posted: Fri Feb 12, 2016 12:27 pm
by tuupakku
Thanks for the update.

By the way in example 0015 (Rotating images) line 10 should probably be rewritten to something along the lines of:

Code: Select all

angle = (angle + dt) % (2 * math.pi)
to avoid those infinitely growing numbers.

Also isn't this example very weirdly named? You would think it's an example of a sprite rotating in place, but it's actually just circular motion.

Re: examples.love

Posted: Fri Feb 12, 2016 12:53 pm
by rmcode
Maybe we should also have a thread about the org here on the forums. It probably makes sense to also add the love-api and the awesome-löve list to the organisation?

Re: examples.love

Posted: Fri Feb 12, 2016 3:08 pm
by Jack5500
rmcode wrote:Maybe we should also have a thread about the org here on the forums. It probably makes sense to also add the love-api and the awesome-löve list to the organisation?
I think that's a great idea.
I added the awesome list. Could you add your love-api repo?

Re: examples.love

Posted: Fri Feb 12, 2016 3:33 pm
by rmcode
Done :)

Re: examples.love

Posted: Fri Feb 12, 2016 3:37 pm
by Jack5500
:3 Great

Re: examples.love

Posted: Fri Feb 12, 2016 5:12 pm
by monolifed
I wonder if it is possible to make the examples android compatible without polluting them with checks.

Re: examples.love

Posted: Fri Feb 12, 2016 8:20 pm
by alissona2
ingsoc451 wrote:At least it doesn't loop

You can add

Code: Select all

function love.keypressed(k)
    if k == "escape" then video:pause() end
end
in fact it can loop, but not natively ... did an alternative code for that:

Code: Select all

if vid:isPlaying() == false then --loop
	vid:pause()
	vid:rewind()
	vid:play()
end