Firing bullets with the mouse


show more Firing bullets with the mouse provides you with in-depth training on Developer. Taught by Lee Brimelow as part of the Building Flash Games with Starling show less
please wait ...

Firing bullets with the mouse

So in the last movie we started to fill out our BulletManager functions here for updating and for firing, but we only want to fire bullets when the user has their mouse down, so when they actually have the mouse button down. So let's set that up in the play state. So the first thing I'm going to want to create is a new instance of the BulletManager class. I'm going to come under where we created our hero and I'm going to create a variable called BulletManager. It's going to be of type new BulletManager.

Now remember to that we need to pass in a reference to our play state here. So I'm just going to pass in this. Again, let's create bulletManager as an instance variable. So now what we want to do is to create a Boolean value. We're going to create a public Boolean property here, public var, and we're going to call it fire. This is going to be able to tell the BulletManager whether it should fire a bullet or not. Now we're going to set it at the default ...

Firing bullets with the mouse
Video duration: 7m 24s 2h 57m Intermediate

Viewers:

Firing bullets with the mouse provides you with in-depth training on Developer. Taught by Lee Brimelow as part of the Building Flash Games with Starling

please wait ...