In this Scratch tutorial you will learn how to create someone firing a gun in an animation.
Tags:How to Create someone Firing a Gun - Scratch,adobe software tutorials,adobenicnacs,create animation,create gun firing animation,digital manipulation,scratch,scratch tutorial
Grab video code:
Transcript
Hi guys and welcome to this video bought you by adobenicnacs. And in this one this is one of the 5 videos I promised to make up for the absence videos. This is the scratch one and I thought we do something kind of fun. So a lots of times wherever it maybe, I get asked sprite shoot, probably with a gun something like this or a third person type game how do you make them shoot.
So I thought what we will do is I’ll show you how to do that today trying to do it under 10 minutes. But to make it more interesting I’ll improvise so, I haven’t got anything written down. I don’t usually do anyway but I haven’t practice this before hand or you see I haven’t it, I mean within the last week, not week, month, two months. I haven’t done this in ages so we’ll improvise and you can see what natural scenario is to me but I’m trying to design so that you can see what errors I make, how I resolve them. I just want to be interesting to see how it goes.
So enough talking I probably got like nine minutes left. I’m creating a new one and I’m done from this brand new. We’ll make the cat sit, so save and create new sprites. We’ll call this and then let’s creates a gun sprite so click the new sprite button that’s the one down here. I’m not going to go over everything because it’s not that hard and zoom that a bit here and I’m just going to draw a gun. And this is not an art tutorial, it’s a scripting tutorial so let’s get something done—a red. This is my fantastic gun and we’ll take care of that, okay that’s my gun.
So the new sprite limit gun and just for all, we’ll grab a when green flag is clicked motion will say go to cat and see how that works. Okay so a bit high up so what we will do is to get it positioned exactly, we’ll say. Just to let you know I’m using Scratch1.3 by the way and set go to X and we’re going to sensing we go X position of cat. So we can send to the X position of cat and then we’ll going to need to add a bit on to that to make right up his arm. So let’s try to add 25 just about does it and then we use only one the Y position of cat and that finished just about right. So we can start that in and we also make sure that forever block. So if we make our cat trackable. So, I lock it and we will go full screen mode, you see it will always go to that because cat’s seems to be always in front so we go to gun and when to looks, go to looks and choose go to front, so always be able to run from the track, lovely.
Next what we’re going to do is we want to make the gun point towards the mouse. So we can do a simple script and point in dark, go to motion and point of direction and I should know point towards mouse pointer. You need top make sure the gun is pointing, by the way it’s firing is right when you draw the sprite. Is that right and we need see the gun what the position is going to be firing and when you draw it needs to be right like this. So that way it will always just work so we go at that and fire. Okay it’s not the greatest animation in the world I suppose but it works. So now, we’ll just really quickly add some movement in to make it a little bit more interesting stuff here. And when this clip is forever, left r key pressed motion change X by one is 5 and right r key is pressed change it by 5. Find that out it works fun.
Next we’ll create out our enemy, which will just be this ginormous something blob with wings or something, I don’t know. That’s our object and we’ll name this blobby for lack of a better name and when this clicks forever motion move 10 steps because he points in that way and if on edge bounce so it should do something like this. And make sure you check that so rotate, flip rotates.
Now let’s actually get to the firing, so let’s first create our bullet. The bullet can be green from the heck of things. That’s not really a bullet is a sort of slug. Full intense purposes, so when spacebar and when space key is pressed and if so the way I want you to think about is this what’s the first thing you need to do when fire a gun. You need to reload, so as in you already fired one, and you need to reload. So when the space key is pressed motion go to or as no—you need a dot on this one done on the bullet. So when the space key is pressed you want to go to the gun. Go there it goes there which is good enough and make sure it’s hidden so you can’t see it so when we pressed this space key mentioned in the bullet as well it will go to the gun.
Next what we will need to do is when you fire. So we then want to do point in direction and we can go to the send sensing and find the direction of gun. So we got that so point on the same where the gun is pointing and then repeat until touching, what we can do is touching edge and we can grab all block. And then touching blobby, this is one of the ten minutes. So it’s going to do what is said in here until it’s touching the edge or touching blobby. And that’s going to be moving steps. And then once you’ve done that, it’s touching blobby and then you want to—and then what we’re going to do is do nothing but going to skip that and save. This is why I did this so you can see my mistakes so you can ignore that. And we’re going to hide it, go to blobby and we will do when you click forever and then if touching bullet we can show, not show, hide. It’s going to die, but it moves you need to show it stop. So when restart the game it will work fine. So now if we go full screen mode, we test it, and we press space the bullet won’t fire because we forgot to tell it to show when we fire so let’s press first go to the gun and actually want it to hide before it goes to the gun. Well it made much difference but when you are going to proper coding it will well it should do I think. Most basically press hide go to gun put in direction so when that’s done. That’s about to how it works and there we go. Let’s try that so it’s going to show just before it starts to fire.
And now you can see our gun that fires and if we do hit the guy he vanishes. So there you go, I don’t have much time you got left let’s just hope it’s on 10 minutes and I hope you’ve enjoyed this video. It’s one of 5 promised ones so we got plenty more to come. If you like these videos please comment, rate and subscribe to my videos if you like them of course. And I’m trying to get to 100 subscribers before the 31st of August 2009, so if you haven’t already knew quick ask to my videos. Please subscribe and it really means a lot to me and by offering that thank you very much for watching.
Comments