 Okay, this is just to show you something I've been working on. It's still working on a lot. It's changing a lot. Every time I make something a day later, I completely rewrite it. It's coming up the best way to do this. And basically, it's at my GitHub page. It's called Phaser Minimal Setup, and really I should just call it Phaser Setup. And it's just to help you make games quick. And it works well with my Vim setup, because a lot of the, I have a lot of shortcuts for a lot of the stuff in here in my Vim setup, so you want to check out that project as well. But you see here, I have a web server running, and I'm in a test folder that's not currently exist, so I'm going to create that. And inside the Git project, for the Phaser Minimal Setup, there's a script called PhaserGit, which will download that repository as a zip file, unzip it and name the folder, the name of the project you give it. So I'm just going to call it Test. So I'm going to do that. It downloads the project, unzips it, and now I have a folder called Test. You can see your project is in Test, and I can move into Test. And in here, let me list out the files here. We have an index, PHP. We have RJS. We have the libraries for Phaser, License, GPL License. And then we have some PHP scripts. The script I just ran to create this project, read me, and some resources. So I have defaults, a couple of images and sounds in there to get you going. But now that we've created that, if we go back to the web browser and I refresh, you can see you have a blank canvas with a full screen button, so you can make your game full screen. I do use Twitter Bootstrap here to align everything. And every time you refresh by default, it gives you a different color background, which you can obviously change. So in here, we have these two PHP files, load images and load sounds. And when you request those, they give you a list of all the images and sounds inside the resources, images, and sounds folder. So this way, if you look at the main script here, so under our JS folder, main JS, which is where you would do most of your work, we have a preload function, it will preload all images and sounds. And I wrote these little scripts that basically, what they're going to do is they're going to request that list from PHP so you don't have to go in and add. And if you add an image or a sound, you don't have to go and add it to your script, you just add it to the folder, and this will automatically find it and preload it at the beginning of your game. So there's that. And then also inside the resource source folder, there is a shell script called snd encode for sound encode. And what that does is if you put mp3s inside the sound folder, you run that and it will generate AUG files for you based on those mp3s so you have both and my script loads both. So you're good for all browsers. So let's go ahead again and go back into the main JS. And again, this works well with my Vim setup, which has a lot of presets in it as well, especially for my little template here. But let's say that we wanted to create a sprite, a player sprite. I can type in PHA and hit Ctrl-X and Ctrl-K, and you can see it gives a list of all my presets for phaser commands. So I'm going to choose the one that says Sprite and when I hit Enter, it just puts in some stuff and I can start typing player. I know one of the default images I have is called tux and then player. This will center the image, which I like to do with most objects in my game. Put its center point at the center of the image rather than the top left. So let's go ahead and save that refresh. You can see we have that image there. Now what I can do is I can do phac, Ctrl-K. Ctrl-X, Ctrl-K and I have click and when I hit Enter there, it has a click object. By default, it puts the player in there, but of course you can change that to anything. And then it will call a function. By default, the function called click, but you can change that and name it whatever you want. So let me go ahead and say function click. And here I'm going to say this, which will be whatever sprite you're passing it. I'm going to say rotation plus equal dot one. I'll save that, run this again and when I click him now, you can see every time I click him, he rotates a little bit. And I'll probably add a mouse down option later on because right now I just have the click option. So I mean Phaser makes things easy. I'm just trying to make them shorter as possible to make some basic things really quick. Let's add a little bit more and let's do a mouse follow. So I'm going to go down to our update function because this is something that has to be checked constantly. And I'm going to do Ph-A-F, Ctrl-X, Ctrl-K and you can see we have a fade if I want to fade a sprite in and out. Or mouse follow or follow mouse signing and I'm going to hit Enter. And there you can see again by default I have it put the player in there in a velocity. You can change the sprite and if you don't pass the velocity, that function will automatically put it in at I think 400. Save that. Refresh, you can see it's following the mouse. Let's go back here and actually comment that out for a second and I'm going to scroll down to the bottom here and I'm going to type in Ph-A-K and hit Ctrl-X, Ctrl-K to do Phaser keys and I hit Enter. It creates a function called keys and we can pass it a sprite. And by default I have left, right, up, down and space bar but you can add other keys and what you want to do but right now it moves the sprite at a certain speed so what I'm going to do in here in our update function is I'm going to type in Ph-A or actually not Ph-A, I'm going to type in keys and pass it the player. And now we've disabled our mouse follow but I can use my arrows to move him around. And if I wanted to change his speed I can either pass it in this function here or when I create the player or whatever object in the game I can give it a player dot speed and we'll give it 800. So it's a little bit faster than before and if I refresh now you move what just happened. Oh, okay, let's go ahead and comment that out for a second. Let's give him some gravity. So I'm going to type in Ph-A-G and hit enter and you can see that we've now passed it our gravity. We're passing it the player by default. Again you can change that bounce, world, gravity. I'm going to save that refresh and now he has some gravity and he bounces off the wall. So I guess without the gravity that speed I was given it does something funky. I'm not really sure what that's all about but that's the first time I've done that usually I give him gravity before I start moving him around the screen. I do need to play with that because you might want a game where you don't have gravity. So this is something that I'm heavily working on and it's changing a lot as I go. So he can move around but let's say we want to go back and have him either move when I press keys or when I press the mouse, now I press this and you can see he's following the mouse but if I try to use the keys he doesn't want to leave the cursor. So what we need to do is set it to where he only follows the cursor when a touch screen is being touched or the mouse is being clicked. So what I'm going to do is I'm going to go down to the bottom here and or actually not down to the bottom. I'm going to go to I believe update is where I want that. I'm going to type in PHA and again look at my list here you can see mouse down so we have click for clicking an object mouse down means anytime you click the mouse anywhere in the game. I'm going to hit enter there and yeah I did put that in the wrong spot. I want to put that here because I'm going to create a function. Again I've changed this so much in the last couple of days but hopefully once I have it done I can use this pretty quick. I mean it's already pretty quick even with me changing things a lot. So let's create a mouse function here that is whenever the mouse is down do something you can see if the mouse's cursor is down do something if not do something else and I'm going to grab the follow and put that in here and now if I refresh you can see I can move him with my arrow keys and I can click with the mouse and he's not following it. What am I doing? Oh right I've got to add the mouse down function to my update. That's why I started to put that there earlier I ended up almost putting a full function there but I just want to call the function there we go. So it's constantly checking is the mouse being clicked and if so now follow it and you can change the velocity of what you're passing it and he bounces off the wall but when I'm not clicking with the mouse or touching with the screen I can use my arrow keys to move him around but that's just a quick look at that. Thank you for watching again I'm going to play with this a lot go ahead and have a look at it let me know if you have any questions and as always I hope that you have a great day.