Hello guys!
I have a problem with AnAL lib, when I insert one enemy, the animation is normal for the enemy but when I insert more than one enemy the animation of walking is speeded-up.
Video : https://www.youtube.com/watch?v=e_K8kyNhcJs
Thank you in advance, if you need more information to help me ask me, and sorry for my bad english
[Solved] Problem with AnAL - Animation speeded-up
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[Solved] Problem with AnAL - Animation speeded-up
Last edited by NowakFul on Tue Jul 14, 2015 9:36 pm, edited 1 time in total.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Problem with AnAL - Animation speeded-up
You're probably updating the same animation twice.
Re: Problem with AnAL - Animation speeded-up
Thanks for the answer, but the only update that I have in my code is here :bartbes wrote:You're probably updating the same animation twice.
Code: Select all
if self.walking == "true" and self.direction == "left" then
walking_left_bomber:update(dt)
self.x = self.x - self.speed
end
if self.walking == "true" and self.direction == "right" then
walking_right_bomber:update(dt)
self.x = self.x + self.speed
end
if self.walking == "false" and self.direction == "right" then
dont_walking_right_bomber:update(dt)
end
if self.walking == "false" and self.direction == "left" then
dont_walking_left_bomber:update(dt)
end
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Problem with AnAL - Animation speeded-up
Yes, so what happens if walking_left_bomber and walking_right_bomber are the same? We can't diagnose this properly if you don't share the code.
Re: Problem with AnAL - Animation speeded-up
So..bartbes wrote:Yes, so what happens if walking_left_bomber and walking_right_bomber are the same? We can't diagnose this properly if you don't share the code.
LOAD
Code: Select all
mobObj.walkright_bomber = love.graphics.newImage('image/MOB/bomber_right.png')
mobObj.walkright_bomber:setFilter( "nearest", "nearest" )
mobObj.walkleft_bomber = love.graphics.newImage('image/MOB/bomber_left.png')
mobObj.walkleft_bomber:setFilter( "nearest", "nearest" )
mobObj.dontwalkright_bomber = love.graphics.newImage('image/MOB/bomber_right_nomove.png')
mobObj.dontwalkright_bomber:setFilter( "nearest", "nearest" )
mobObj.dontwalkleft_bomber = love.graphics.newImage('image/MOB/bomber_left_nomove.png')
mobObj.dontwalkleft_bomber:setFilter( "nearest", "nearest" )
walking_right_bomber = newAnimation(mobObj.walkright_bomber, 6, 9, 0.10, 0)
walking_left_bomber = newAnimation(mobObj.walkleft_bomber, 6, 9, 0.10, 0)
dont_walking_right_bomber = newAnimation(mobObj.dontwalkright_bomber, 6, 9, 0.50, 0)
dont_walking_left_bomber = newAnimation(mobObj.dontwalkleft_bomber, 6, 9, 0.50, 0)
Code: Select all
if self.walking == "true" and self.direction == "left" then
walking_left_bomber:update(dt)
self.x = self.x - self.speed
end
if self.walking == "true" and self.direction == "right" then
walking_right_bomber:update(dt)
self.x = self.x + self.speed
end
if self.walking == "false" and self.direction == "right" then
dont_walking_right_bomber:update(dt)
end
if self.walking == "false" and self.direction == "left" then
dont_walking_left_bomber:update(dt)
end
Code: Select all
if self.walking == "true" and self.direction == "left" then
walking_left_bomber:draw(self.x, self.y,0,12)
end
if self.walking == "true" and self.direction == "right" then
walking_right_bomber:draw(self.x, self.y,0,12)
end
if self.walking == "false" and self.direction == "right" then
dont_walking_right_bomber:draw(self.x, self.y,0,12)
end
if self.walking == "false" and self.direction == "left" then
dont_walking_left_bomber:draw(self.x, self.y,0,12)
end
Re: Problem with AnAL - Animation speeded-up
The .love would be excellent
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Re: Problem with AnAL - Animation speeded-up
There it is!davisdude wrote:The .love would be excellent
- Attachments
-
- game.love
- (27.09 KiB) Downloaded 145 times
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Problem with AnAL - Animation speeded-up
The animations are stored in global variables and shared by the two enemies, so when they both update, the animations get updated twice. You probably want to store the animations on the enemies themselves, or make sure to update the animations only once.
Re: Problem with AnAL - Animation speeded-up
I've tried things and I've searched on the forums but I doesn't find how I could do this. By which means can I make it? am a bit new to programming sorry.bartbes wrote: You probably want to store the animations on the enemies themselves, or make sure to update the animations only once.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Problem with AnAL - Animation speeded-up
You're doing it for almost every other variable already, you just have to store it in self (or mobObj), if you do the same with the animations, it should be fixed.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 4 guests