Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 16,302 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problems with backward animation #248102
01/24/09 15:01
01/24/09 15:01
Joined: Oct 2008
Posts: 67
C
Crypton Offline OP
Junior Member
Crypton  Offline OP
Junior Member
C

Joined: Oct 2008
Posts: 67
I'm doing one FPS tutorial. it's a bit old and probably for C-Script, but I'm doing quite well coding it in LiteC. Now I have bumped into a problem. There is a code for reversing the animation. It seems logical enough but doesn't work for my model.

It's from inside the action:
Code:
while (player != NULL)
   {
      spdx = (key_w - key_s) * 3 * time_step; //walking speed
      [..]

      //Animation control
      if (spdx == 0 && spdy == 0) //If no movement
      {
         walk_percent = 0;
         //Works great
         idle_percent = (idle_percent+5*time_step)%100;
         ent_animate(me,"stand",idle_percent,ANM_CYCLE);
      }else{
         idle_percent = 0;

         //Doesn't work!!!
         walk_percent = (walk_percent + sign(spdx)*6*time_step)%100;
         //walk_percent = (walk_percent + sign(move_vec[0])*5*time)%100; //Original code from Tutorial

         ent_animate(me,"walk",walk_percent,ANM_CYCLE);
      }
      
      wait(1);
   }
[..]


Any idea what's the case? My model has 8 walk frames. My model walks forward nicely but when it's going back it doesn't do the animation only the first walk frame is shown although the walk_percent runs nicely!


New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Re: Problems with backward animation [Re: Crypton] #248121
01/24/09 17:23
01/24/09 17:23
Joined: Oct 2008
Posts: 67
C
Crypton Offline OP
Junior Member
Crypton  Offline OP
Junior Member
C

Joined: Oct 2008
Posts: 67
Hmm got it worked.
I added +100 at the end of calculation.

walk_percent = (walk_percent + sign(spdx)*6*time_step)%100+100;

Now the percent runs between 100 and 200 and when reversing animation it runs nicely from 200 to 100 thus creating the backward motion. So why didn't the first code work, though it should have?

I saw that animation didn't run from last frame to first. Function seems to cycle always from the very first frame. And when creating backward motion and reaching to the first frame it starts from the first frame again showing only one frame.


New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1