Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: monkey0506 on Sat 18/10/2008 09:26:05

Title: MODULE: SparkleMotion v1.02 - Discworld Style Cursor Animation
Post by: monkey0506 on Sat 18/10/2008 09:26:05
I did a bit of research to ensure I wasn't being daft, so I'll quote my source:

QuoteIn Discworld, the mouse cursor is an intelligent 'sparkly thing', which leaves a trail of stars behind it as it moves...
Nick Fenwick, <http://www.mismatch.co.uk/discworld1.htm (http://www.mismatch.co.uk/discworld1.htm)>. Retrieved 18 October 2008.

For the record, as of this writing AGS doesn't allow alpha-channels to be copied via the DrawingSurface.DrawImage function onto a transparent background (it flattens), so they won't work.

As for the name of the module, it's in tribute to one of the greatest movie-films of all time, Donnie Darko. If you've seen the film, you'll know all about it. ;)

Requires AGS 3.0.2 or higher!

v1.02 Update:

Fixed the bug if the x- or y-coordinate of a "spark" was 0, thanks to Ghost for the report! Also added gravity and wind to allow for more dynamic "spark" animation, thanks to ProgZmax for the suggestion! The demo has also been updated and now has example usage of gravity, wind, and both modes (pixel and sprite).

Also removed demo code from the body of the module (for example, turning debug mode on).

v1.01 Update:

Added support for sprite "sparks" loaded from a view. Two important notes are that I have not done extensive testing of sprite mode and it could quite probably slow down the game, and also that alpha channeled sprites will not work properly as "sparks." This is due to a limitation in the DrawingSurface.DrawImage function. Further, the demo game has not been updated as of this release, so to see sprites as sparks you'll have to try it out for yourself.

v1.0

This is a very preliminary sort of cursor animation, using single-pixel "sparks" in the same way that the Discworld cursor would leave a trail of stars. It currently accepts a primary color as well as a deviation parameter to allow multiple color sparks. If this module "sparks" enough interest, I may look into expanding it to use sprites instead of just single pixels.

Download the module (http://monkey.05.06.googlepages.com/SparkleMotion_102.rar)
Download the module+demo (http://monkey.05.06.googlepages.com/SparkleMotion_Demo.rar)


(http://monkey.05.06.googlepages.com/SparkleMotion_Demo_1.png)
(http://monkey.05.06.googlepages.com/SparkleMotion_Demo_2.png)
Title: Re: MODULE: SparkleMotion v1.0 - Discworld Style Cursor Animation
Post by: ThreeOhFour on Sat 18/10/2008 09:59:24
Oh man oh man oh man.

Seriously, like... 12 minutes ago I was saying to myself "Man, I really should try scripting up a cursor like the one in Discworld. I wonder how it is done? Maybe I should ask someone..."

12 minutes, maybe less.

That's freaking strange, and also you're the man for creating this thing that I've always wanted to have in one of my games!
Title: Re: MODULE: SparkleMotion v1.0 - Discworld Style Cursor Animation
Post by: on Sat 18/10/2008 13:51:55
Lovely work! There was a different version if this some several years ago, but it didn't work haslf as smooth (it had characters following the pointer)!

Really sweet, even though I will now forever relate this module to Patrick Swayze ;)

edit:

Found a tiny bug- the upper line (y 0) and the leftmost row (x 0) doesn't delete the sparkles. So moving the mouse there will leave artifacts...
Title: Re: MODULE: SparkleMotion v1.01 - Discworld Style Cursor Animation
Post by: Shane 'ProgZmax' Stevens on Sun 19/10/2008 17:46:20
The sparks should probably react to gravity (ie, fall) as they are generated and then be removed once they are off screen (or if you color fade each particle to black).  Right now they just sort of stay in one place awhile and then pop out of existence.  Aside from that, it's a good idea!
Title: Re: MODULE: SparkleMotion v1.02 - Discworld Style Cursor Animation
Post by: monkey0506 on Mon 20/10/2008 04:30:11
Thanks for the bug report Ghost and suggestion Prog! Both of these have now been implemented in v1.02. As for the suggestion on gravity Prog, I haven't actually made the sparks fall all the way off screen, partly due to the fact that if there are SparkleMotion.MaxSparks sparks currently shown, it will have to remove one to draw any new sparks...but I would say that the dynamic movement of the sparks does give it a nicer touch than them just hanging there.

Last night I spent some time looking into alpha channeled sprites because I had a thought regarding DynamicSprite.CopyTransparencyMask, but unfortunately it still isn't a possibility. So we'll still have to wait for official alpha support for DrawingSurface.DrawImage. Also another thing to consider is that this would also require Overlays to support partial transparency as well...

Edit: If you downloaded v1.02 of the module before 9:30 A.M. GMT, please re-download it. I accidentally had some of the demo code in the module scripts. I've corrected this, but if you downloaded within the last 5 hours you'll need to download again.
Title: Re: MODULE: SparkleMotion v1.02 - Discworld Style Cursor Animation
Post by: on Mon 20/10/2008 19:22:16
Come to think of it, the original Discworld (http://de.youtube.com/watch?v=TieJD2M_5q4&feature=related) sparkly cursor didn't have gravity if I am not mistaken.

Fixed version works a tread. Good job there!
Title: Re: MODULE: SparkleMotion v1.02 - Discworld Style Cursor Animation
Post by: Dualnames on Wed 22/10/2008 10:54:05
Downloading..woot woot woot.