[Unsolved]set_animation() running backwards?

Termos
Member
 
Posts: 277
Joined: Sun Dec 16, 2018 12:50

[Unsolved]set_animation() running backwards?

by Termos » Fri Aug 02, 2019 11:57

I wonder if it is possible to run animation backwards, that is frame number decreases over time instead of increasing.
I've tried things like {x=10,y=1}, but it still runs forward and then wraps around.
Last edited by Termos on Mon Aug 05, 2019 16:57, edited 1 time in total.
 

Eran
Member
 
Posts: 94
Joined: Fri May 03, 2019 16:46

Re: set_animation() running backwards?

by Eran » Fri Aug 02, 2019 12:14

You can set a negative animation frame speed, I just tried it out.
So
Code: Select all
object:set_animation({x = 1, y = 10}, -n)
 

Termos
Member
 
Posts: 277
Joined: Sun Dec 16, 2018 12:50

Re: set_animation() running backwards?

by Termos » Fri Aug 02, 2019 12:33

Eran wrote:You can set a negative animation frame speed, I just tried it out.

Tried that too, animation just did not run. I'll check again.
 

Eran
Member
 
Posts: 94
Joined: Fri May 03, 2019 16:46

Re: set_animation() running backwards?

by Eran » Fri Aug 02, 2019 16:57

If you haven't got it working in the meantime, I suppose that either somewhere else your mod interferes with negative frame speeds or it's a change that's happened between the version that you use and the 5.1.0 dev version that I use.

I attached the mod I used to try this. When you start the game with it and press F7, you should see the player model play a death animation in reverse before you move or do anything. It is incompatible with player_api. The relevant code is in line 92 of init.lua
Attachments
dwarf_characters.tar.gz
(43.62 KiB) Downloaded 4 times
 

Termos
Member
 
Posts: 277
Joined: Sun Dec 16, 2018 12:50

Re: set_animation() running backwards?

by Termos » Fri Aug 02, 2019 22:35

Almost got it to work.

It runs backwards sometimes, but it seems to exhibit undefined behavior, probably based on previous animation frame it sometimes skips to the last frame instantly. Also it seems to break normal forward animations which run after.

That is when frame_loop = false.
When it's looping it seems okay.
 

Termos
Member
 
Posts: 277
Joined: Sun Dec 16, 2018 12:50

Re: set_animation() running backwards?

by Termos » Mon Aug 05, 2019 16:57

Done some more testing, think I can say what's wrong.

If an animation follows another animation with frame_speed of opposite sign, it skips directly to the last frame.
Affects only frame_loop=false animations.

Can't say if it's a bug, cause I'm not sure negative speeds were even intended, but it probably is.

One of the test setups:
Code: Select all
if mobkit.timer(self,2) then   -- runs every 2 secs
   if self.forth then
      self.object:set_animation({x=1,y=15},7,0,false)
      self.forth = false      
   else
      self.object:set_animation({x=15,y=1},-7,0,false)
      self.forth = true
   end
end


It is supposed to play alternating forth and back animations, instead, only the first one runs as expected, all the subsequent animations are skips to the last frame.
If both animations are the same sign all is good.
 

User avatar
runs
Member
 
Posts: 1012
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

Re: set_animation() running backwards?

by runs » Tue Aug 06, 2019 10:08

Termos wrote:Done some more testing, think I can say what's wrong.

If an animation follows another animation with frame_speed of opposite sign, it skips directly to the last frame.
Affects only frame_loop=false animations.

Can't say if it's a bug, cause I'm not sure negative speeds were even intended, but it probably is.

One of the test setups:
Code: Select all
if mobkit.timer(self,2) then   -- runs every 2 secs
   if self.forth then
      self.object:set_animation({x=1,y=15},7,0,false)
      self.forth = false      
   else
      self.object:set_animation({x=15,y=1},-7,0,false)
      self.forth = true
   end
end


It is supposed to play alternating forth and back animations, instead, only the first one runs as expected, all the subsequent animations are skips to the last frame.
If both animations are the same sign all is good.


So make a bug request.
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 3 guests