Animation won't stop, can't tell what went wrong

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
Mario-Fan
Prole
Posts: 18
Joined: Wed Jun 06, 2012 6:37 pm

Animation won't stop, can't tell what went wrong

Post by Mario-Fan »

Yes, I'm working on yet ANOTHER project and have hit yet ANOTHER problem. The player animation for moving up and down won't play, and the animation for moving left and right won't stop. The purple areas on Link's sprite sheet are unused. It's based off a platformer engine by Sean Laurvick (at least, that's what it says in the files), so there are bound to be some bugs in it. (Also the scaling in the options screen isn't working. I coded in the scaling and tried the advice I got when I was scaling that Mega Man engine and it didn't work so I removed the code.) I'm sure there's something as obvious as the screen on this laptop (I'm sorry, I couldn't think of anyting else) that I'm missing, but I'm not sure what it would be.
zeldax.love
Source code
(63.84 KiB) Downloaded 117 times
I know I didn't ask the ripper of the font (Desgardes from the Spriters Resource) for permission, but I'm going to ask the project leader (Crownjo from Exploding Rabbit Forums) to rip the font so I don't have to ask or even credit Desgardes.

Also, for some reason, when it's compressed, it uses the default LOVE screen size, but unpacked it works the way it should.

On a side note, the first thing done in the whole program apart from the stuff in the config file is setting the background color to white. This is done to save energy on LCD screens.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Animation won't stop, can't tell what went wrong

Post by Roland_Yonaba »

Mario-Fan wrote: Also, for some reason, when it's compressed, it uses the default LOVE screen size, but unpacked it works the way it should.
Make sure to create a configuration file.
Mario-Fan
Prole
Posts: 18
Joined: Wed Jun 06, 2012 6:37 pm

Re: Animation won't stop, can't tell what went wrong

Post by Mario-Fan »

Roland_Yonaba wrote:
Mario-Fan wrote: Also, for some reason, when it's compressed, it uses the default LOVE screen size, but unpacked it works the way it should.
Make sure to create a configuration file.
Except that there already is one, skimmer.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Animation won't stop, can't tell what went wrong

Post by Roland_Yonaba »

Also, make sure use the stop() method on your playerSprites object. Fact is, when starting love.update, you use playerSprites:start(), which causes an internal variable, isRunning, to be always true. Hence, the animation will be played anytime.

Code: Select all

function love.update(dt)
    if gameState == "ingame" then
    -- check controls
		if love.keyboard.isDown("right") then
			playerSprites:start()
			...
		end
		if love.keyboard.isDown("left") then
			playerSprites:start()
			...
		end
      ... etc
     end
end

...

[code]function love.keyreleased(key)
    ...
    if (key == "right") or (key == "left") then
       p:stopX()
       playerSprites:stop()
    end
    if (key == "up") or (key == "down") then
       p:stopY()
       playerSprites:stop()
    end
    ...
Haven't tried, but that might solve the problem.
Mario-Fan wrote:
Roland_Yonaba wrote:
Mario-Fan wrote: Also, for some reason, when it's compressed, it uses the default LOVE screen size, but unpacked it works the way it should.
Make sure to create a configuration file.
Except that there already is one, skimmer.
Oh, really ? Can't see it, though.
Attachments
test.png
test.png (45.44 KiB) Viewed 1894 times
Mario-Fan
Prole
Posts: 18
Joined: Wed Jun 06, 2012 6:37 pm

Re: Animation won't stop, can't tell what went wrong

Post by Mario-Fan »

Roland_Yonaba wrote:Also, make sure use the stop() method on your playerSprites object. Fact is, when starting love.update, you use playerSprites:start(), which causes an internal variable, isRunning, to be always true. Hence, the animation will be played anytime.

Code: Select all

function love.update(dt)
    if gameState == "ingame" then
    -- check controls
		if love.keyboard.isDown("right") then
			playerSprites:start()
			...
		end
		if love.keyboard.isDown("left") then
			playerSprites:start()
			...
		end
      ... etc
     end
end

...

[code]function love.keyreleased(key)
    ...
    if (key == "right") or (key == "left") then
       p:stopX()
       playerSprites:stop()
    end
    if (key == "up") or (key == "down") then
       p:stopY()
       playerSprites:stop()
    end
    ...
Haven't tried, but that might solve the problem.

Oh, really ? Can't see it, though.
For the code mistake, OMG that's some of a leftover attempt at stopping the standing sprite from flashing purple. It's still not fixed though. For the missing conf file, god dammit I hate this laptop's lack of Winrar. (alsoi'musing3gandit'snotstayingconnectedforverylongwhichissuperannoying)
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests