In the last tutorial we created a custom cursor, in this tutorial we’ll address some issues that will make our cursor a lot more useful! Today we’ll learn to make the cursor disappear when the mouse leaves the flash window area and reappear on the return. At the same time we’ll set it up to react correctly during a right click and most importantly maintain it’s position at the top of the stage. This way newly added MovieClips will not be able to appear on top of our cursor.
If you have been around flash for any time whatsoever you’ve probably made a custom cursor. If not this tutorial is definitely for you. However, if you have made a custom cursor then the great thing about this tutorial is that we are going to learn to make an object oriented mouse cursor. What’s the benefits? Well we are going to create a class called cursor that we can use in all our future projects, you’ll never have to write a mouse cursor script again. Well, as long as you don’t want to get crazy and add cool effects that is. This tutorial will work great for your games when you want a new mouse that fits the style of gameplay you are developing. So let’s start the tutorial.
Maybe you’re entirely new to this Tweener thing. Wondering what it is or why in the world you would ever want to use it. Let me give you a list of things you can use Tweener for:
fading in and out any Display Object (MovieClip, TextField, Graphic)
scaling an object up and down or in and out over time.
moving an object across the screen with easing over time.
creating a timer.
rotating an object with easing over time.
Well if we are going to discuss character movement… one of the most important has got to be 360 movement based on rotation. I don’t know if there’s a special name for it, I’ve heard it called everything from 360 degree movement, rotational movement, directional movement, to asteroid style movement. Anyway you want to look at it, it’s a movement style that dates back to arcade games and is definitely a usable option in today’s flash game industry. So how hard is making this angle based movement going to be? Not hard at all.
Honestly this is an addendum to the previous tutorial in this series. This is a simple adjustment to the code we have already wrote but it will give us character movement that eases towards the mouse position instead of keeping a constant speed. It’s a relatively useful effect, I used it in one of my games, Entropy, for the opponent’s paddle movement. So here we go, let’s make our character follow the mouse easing its way into the position.