MODULE: GUIAnimation v2.0 - Updated 20 August 2009

Started by monkey0506, Sat 18/11/2006 05:23:17

Previous topic - Next topic

monkey0506

Based on requests here, I threw this crap together.

What it does is this: It provides functions to animate GUI backgrounds. You set up your sprites in a view just like a normal animation. You then seed the GUIAnimation.Start function with VIEW and LOOP parameters (along with optional FRAME, DELAY, and RANDOMIZE parameters) to begin the animation. The RANDOMIZE parameter (if true) will randomize the frame each loop instead of running as a normal animation. See note below on v2.0.

The module should support loops that run following loops though I didn't explicitly test this feature. As of v2.0 the "Run next loop" setting is ignored.

Which brings us to my next point. This module needs a lot more testing. Most of my tests were superficial, but worked out some minor logic errors. Also...there's no support for flipped frames. So...they don't work. I have done more extensive testing of the latest version and it should be stable. Further I have added support for flipped frames.

Anyway, let me know what you think or if you have any problems!

monkey

Requires AGS v3.0 or higher! (v1.0 requires v2.72+)

Download GUIAnimation v2.0
Download GUIAnimation v1.0
v1.0 Mirror (Thanks Neole!)
Read the GUIAnimation v1.0 manual online

20 August 2009:

v2.0
I got tired of waiting to regain access to my own computer so I rewrote the whole thing from scratch for AGS 3.0+. The module now uses extender functions such as GUI.Animate to make the thing easier to access, and I mirrored the Character functions. I removed the ability to randomize the frames because that was bothersome. If anybody wants it I can look into adding it back. I did however add support for flipped sprites as well as linked audio (supporting both ViewFrame.Sound and ViewFrame.LinkedAudio for 3.2+). This module is not backwards compatible with v1.0 so I'll leave the links for that up.

Shaque

It sounds interesting, but I could neither link to the RAR or save target as. It just sends me to the file server without info on the file. :(
Knowledge is a right, wisdom is a choice.

monkey0506

Hmm...yes I really don't like this server for hotlinks. Copying and pasting usually seems to work.

I've now hosted a mirror via Neole's hosting space, here.

Reminder

Update: the link are broken. I post  a new one I've found on the net:

http://meleepta.110mb.com/

"With a lot of carefull"

monkey0506

Thanks for posting a working link. I've actually got an updated version of this all ready to go (just working out a few kinks) back home but I'm away from my primary computer now.

On an unrelated note it figures that 100mb would still have this up...seeing as I haven't signed in there probably any more than once or twice in the last year or two... ::)

Knox

Diggin' up a ooolldd thread :)

Hey Monkey,

Do you know if there is currently any way to have "int delay" a float instead? It seems for my page-flipping animations, if I set it to 1 its a bit slow, but at 0 its way way too fast (we dont even see  the animation)...I was thinking perhaps a delay of something like 0.5 could do the trick:

float delay instead of int delay?
Code: ags
gQG_PageTurnGUI.Animate(iLoop, 0.5, eOnce, eBlock, eForwards); 



--All that is necessary for evil to triumph is for good men to do nothing.

monkey0506

The delay is set in game loops, so a float wouldn't make sense. It's impossible for the script to do something between game loops.

Knox

#7
ah crap, ok I see! Ill try something else then.

**I used some old voodoo magic I learnt from my neighbour and I can now do stuff inbetween game loops! Ill post the incantation if anyone else is interested :)
--All that is necessary for evil to triumph is for good men to do nothing.

Knox

Hey Monkey,

Great module! I have another question (maybe this one doesnt make sense either):

When I have a blocking script running (like "Say", for example), my wait cursor animates no problems. However, Ive noticed if I use the GUIAnimation's "animate" with "eBlock", I will see my wait cursor, but that cursor doesnt get animated.

Do I need to do this manually, is it something we can fix in the module, or am I not doing something right/not understanding correctly?
--All that is necessary for evil to triumph is for good men to do nothing.

monkey0506

Well I would have imagined that AGS would be animating your wait cursor appropriately..obviously not the case then I guess.

In order to create the blocking animation I'm calling the Wait function directly, but perhaps the problem lies in the fact that I'm calling Wait(1), so AGS doesn't have time to animate it before it considers the thread non-blocked again, and stops using the wait cursor (although by the next game loop I've called it again so it switches back to the wait cursor appropriately).

There's not presently a way for the script to check if a mouse cursor mode has a view set (this is one of the write-only properties of the mouse structure :-\), so it's not really viable to do this generically within the module, but you could handle it yourself by manually changing the wait cursor's graphic while a blocking GUI animation is being run..the basic gist of that would look something like:

Code: ags
// top of script
bool block = false; // whether we have a blocking GUI animation running
int mcframe = 0; // the current mouse cursor frame

// animate GUI blocking
block = true; // do this BEFORE you call the Animate function
mouse.ChangeModeView(eModeWait, -1); // we'll do this manually
gQG_PageTurnGUI.Animate(iLoop, 1, eOnce, eBlock);

// repeatedly_execute_always
block = ((block) && (gQG_PageTurnGUI.IsAnimating()));
if (block)
{
  ViewFrame *frame = Game.GetViewFrame(VWAIT, 0, mcframe);
  mouse.ChangeModeGraphic(eModeWait, frame.Graphic);
  mcframe++;
  if (mcframe >= Game.GetFrameCountForLoop(VWAIT, 0)) mcframe = 0;
}


That's a bit silly in that it doesn't take any type of animation delay into account whatsoever, but it should set you off in the right direction.

Knox

Ok this is cool, I'll test it out and let you know what happens!

Thnx :)
--All that is necessary for evil to triumph is for good men to do nothing.

Knox

--All that is necessary for evil to triumph is for good men to do nothing.

monkey0506

Seriously, as many graphical effects as you're throwing into that game you're going to need like dual quad-core 64-bit 3.5 GHz processors with 12 MB caches for each core and a TB of RAM to play this game..but it sure will look pretty. :=

Knox

hehe...don't forget, to be able to play my game the user will also need three 24" screens, a flux-capacitor from 1885, 2.2 gigawatts of power and 3 pounds of scabs.
:=
--All that is necessary for evil to triumph is for good men to do nothing.

SMF spam blocked by CleanTalk