Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - jdkilby

Pages: 1
Paid Work / Behavior Icon Request: Mouse Follow
« on: June 03, 2011, 09:23:40 am »
I just posted about a new Behavior I created called Mouse Follow.

Would anyone be willing to create an icon for it? It doesn't have to be anything extraoridinary - just something to communicate that it allows an Actor to follow a mouse cursor.

Maybe something like a mouse or mouse cursor with some trailing lines to indicate motion? Or some sort of graphic or character chasing after a mouse cursor? I'm open to ideas.

Shared Resources / Behavior: Mouse Follow
« on: June 03, 2011, 09:15:41 am »
I'm currently working on my first game prototype in Stencyl and thought I'd share my first Behavior of real substance.

When attached to an Actor, the Mouse Follow behavior causes the actor to... well, move to the mouse cursor. The difference is that it adds a "lag" effect so that it isn't just a one-to-one movement of the Actor to the location of the mouse cursor.

The further away the Actor is from the mouse cursor, the faster it moves toward the cursor.

You can set the maximum distance and maximum speed for each axis (the position adjustments are performed individually on each axis). When the Actor is at the maximum distance or greater from the mouse cursor, it moves at the maximum speed.

If you decide to set the maximum speed greater than the maximum distance, the Actor will follow the mouse cursor one-to-one. This is not recommended because this could be done much more simply and efficiently with just a couple of blocks.

Lastly, if you look at the code, you'll see that this Behavior does not use the built-in speed / velocity variables for Actors. I found the performance to be better when I handled calculating and maintaining these variables myself.

It's on the StencylForge... feedback and suggestions are welcome!

Pages: 1