I need help on creating a Fairy Cursor

Started by Kaio, Fri 17/10/2008 19:13:33

Previous topic - Next topic

Kaio

Hi! I'm creating a game using a little fairy as cursor. Here's a screenshot:



I'm now trying to make the cursor leave a trace on the screen, depending on where the player moves the mouse. Here's a quick picture of what I mean:


I hope you understand what I want the curso to do, it's pretty difficult to explain (for me with not english as my 1st language). I tried creating characters following the cursor, but the result was poor. I also want the little "sparkles" to leave, when the mouse isn't moved. I don't know what to try next. Please help me!
Thanks, kaio

TwinMoon

You mean like in DiscWorld?

Well, you can create an animated cursor by selecting the cursor and setting 'Animate' to true and assigning a view to the cursor.
You can set AnimateOnlyWhenMoving to true, so it will only be animated when moving.

I think that's as close as you'll get to what you want.

monkey0506

#2
It would probably be slow but it might be possible to create an overlay which each loop tracks the movement of the mouse and leaves a trail...hmm...

Edit: I've actually got a good theoretical script worked up for doing this. I say theoretical because although my tests currently show no slow-down (40 FPS), there is literally nothing else going on in the game. There is currently one minor issue where some of the little "sparks" as I'm calling them don't remove properly if the mouse isn't moving. Once I get that resolved I'll test it against a project with some characters and things to see if this is a viable solution. First however, I have to go do my actual job...so I'll be back to work on this once I get off of work. ;)

Actually, that was the world's simplest fix. It was just a matter of where I was updating my iterator. But still, I should go to work so I don't get fired. After that I'll test this against a "real" project and hopefully be able to upload the script tonight.

Kaio

Quote from: TwinMoon on Fri 17/10/2008 19:41:27
You mean like in DiscWorld?

Well, you can create an animated cursor by selecting the cursor and setting 'Animate' to true and assigning a view to the cursor.
You can set AnimateOnlyWhenMoving to true, so it will only be animated when moving.

I think that's as close as you'll get to what you want.

I don't know DiscWorld.... and I wan the cursor to react on the players mouse-movement, so when the player moves the mouse right, there should be a trace of the corsor on the left side... omg, its so hard to explain...

monkey0506

#4
For the record kaioshin, I understand exactly what you mean. I haven't played Discworld either, but my tests showed excellent results. I had 4 characters walking and talking in the background while showing these "sparks" trailing the cursor.

I'm documenting my scripts now and then I'll have the first version of this module uploaded, complete with demo so you can see what I mean.

Right now it will only support single pixel "sparks," but if you're interested I could definitely look into using sprites instead which would allow for more variation in sizes/shapes...unfortunately it wouldn't support alpha-channeled sparks though.

It does presently allow for a "primary" color and then a deviation off of that color to allow multiple color options.

You'll be able to better see what I mean when I get it uploaded though. I'll edit this post with a link once it's done.

Edit: Alright kaioshin, you can download the SparkleMotion module and demo game here. I've also got screen-shots so you can see what I'm talking about:



Kaio

WOW! Thats exactly what I mean! Thank you so much monkey_05_06! It would be realy cool, though, if the "sparks" could be sprites instead. And why wouldn't it support alpha-channeled sprites? That would be even better of course. But again, thank you for you fast help!  :D

monkey0506

As far as creating the sparks from a list of sprites, my only worry is that I would then actually have to redraw the entire Overlay each loop. The way it is now it's a bit optimized since it can just draw a transparent pixel to remove the old sparks. Admittedly this can sometimes remove sparks prematurely...but it was the fastest possible method.

I'll definitely take a look to see what type of impact it might create to have to redraw the sprites each loop. And just so I don't forget, I'll go ahead and document the idea now I had that I should include an option to optionally randomize the sprites. Also, I should load the sprites from a view to simplify it. Yes.

Anyway kaioshin, you're very welcome. It was actually a pretty simple process from concept to the raw product. Refining it for public release was the most troublesome part hehe. ;)

Regarding alpha sprites, AGS doesn't currently copy the alpha channel when using DrawingSurface.DrawImage onto a blank canvas, so you'd end up with a nice anti-aliased effect on top of a pink background. Anywhere using the alpha channel would show the canvas on the final product. If I'm not making much sense, just imagine that behind the alpha channeled sprite you had a pink background to represent transparency...and then the image was flattened. That's what you'd end up with.

But like I said, I'll see what I can do about sprites. ;)

nihilyst

AFAIR buloght had the exact same thing you look for in his game "The Family Treasure". Unfortunately, he hasn't been on the forums for a long time, but he had the fairy style cursor without any impact on game performance.

SMF spam blocked by CleanTalk