The Daily Click ::. Forums ::. Klik Coding Help ::. Total number of frames?
 

Post Reply  Post Oekaki 
 

Posted By Message

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
7th September, 2011 at 19:13:52 -

Is it possible to retrieve the total number of frames in an animation of an active object?

I tried to write a fast loop to do this but it didn't work I am tired and falling asleep and I'll try again tomorrow

Sweet dreams x

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
7th September, 2011 at 21:10:08 -

Just store it an alterable value - it's not something that can change at runtime anyway.

 
n/a

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
8th September, 2011 at 01:21:29 -

True, but it would be great if I didn't have to.

I'm working on a game and in this game you can pick up items. Pressing "tab" toggles your item menu. I have an active object storing the icons for each item as different frames in a single animation. There are 40 or so items and I am adding more every day. I have a fastloop which searches for the correct item icon which runs as many times as there are item icons. At the moment I am manually entering this value but I would like to not.

Thanks for your suggesting Sketchy you working on anything at the moment?

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
8th September, 2011 at 16:05:13 -

I think you're out of luck unfortunately
And I'm not really working on anything at the moment. I was developing a sort of HTML5 / Javascript based game engine, but it's been on hold for a while - I wrote a lot of the Javascript already (which I thought would be the hard part), but I'm now having trouble making a program that interprets my custom scripting language (using MMF2).
eg.
If the script says:
objectA = objectB.x * 5
I want to convert that to:
setValue("getValue(objectB, x) * 5");
Or something along those lines - I don't remember exactly. It just becomes a nightmare when you have stuff inside quotation marks, etc.

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49566

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
8th September, 2011 at 17:06:03 -

Why do you need to "search" for the correct icon? Just set it directly.

I have a feeling that your item system is more complicated than it has to be.

 
n/a

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
8th September, 2011 at 18:42:53 -

It probably is haha.

I have item names stored in an array which I create with an external program. Here is an example:

1. Lighter
2. Rolling Tobacco
3. Handgun Bullets
4. Shotgun Shells
5. Cigarette Papers
6. House Keys

I also have an active object with 6 frames. First frame is the "Lighter" icon, second is the "Rolling Tobacco" and so on...

The items can be picked up in-game in any order and are added to your inventory list in the order you pick them up.

When you check your inventory, a loop runs and searches for the name of your selected item and returns what number it is in the external item list. This number will most likely not be the same slot as it is in your inventory. This loop runs the number of times as there are items in the external list and it works fine. Long story, but I wanted to retrieve the total frame number for the Icon Displaying Active Object so it could display a "NO ICON" picture if I hadn't made the icon yet. It won't effect the gameplay at all and I was just curious. Hopefully, I have explained this well enough. Not that it matters at all or anybody cares haha.

Thanks everybody! You're the best

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49566

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
8th September, 2011 at 19:06:24 -

Just make the last frame of your icon object the "no icon" frame.

Then if you try to set the icon to something beyond the number of frames it should automatically be the "no icon" frame since that's the last frame.

Just make sure to place whatever item don't have an icon to the very back of the list. Boom! Done!

 
n/a

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
8th September, 2011 at 19:29:10 -

Now I come to think about it, it does always display the final frame. Hahah I can't believe I didn't think of doing that!

But just to see if I could, I figured it out and made an example showing how you CAN retrieve the total number of frames in an animation. Using a simple fast loop.

Not that there is probably any reason that you could ever want to....

http://www.whenthereisnoroominhellthedeadwalktheearth.com/MMF/TotalNumberOfAnimationFrames.mfa

 
n/a

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
9th September, 2011 at 03:32:02 -

Animation Info Extension is what you need;
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=230118

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456
   

Post Reply



 



Advertisement

Worth A Click