Video Transcript
Pretty simple to put sounds in, we just need to designate where they are going to start. Now, if I wanted to add scoring to the movie, I would generally do it in the same place. Once we have verified that we have actually hit a bubble and popped it, we will use that point to update the score. Now, I will need some display elements to show our score. So, let us get that taken cared off first. I got a little score label down here and that was in my display layer. What I will do is to zoom up on that and we will add a dynamic text field next to it. Let me make sure I do not have that field selected and I will just set my tool up so that I am making a dynamic text field and we can drag one out right next to it here. Now, we will setup whatever properties we would like on that. I think I am not going to go with the same color so I will just go with the white background that will show up good on the green here. I will set to a left aligned, maybe make it bold and a little tiny bit bigger than the original score and of course, we are going to name it.
I use my standard naming convention, we will start off with txt for a text field and I will just name it score. Now, let us bring up our action script panel so we can integrate that score. The first I am going to need is probably a variable just to track the score. So, let us go up to where we are initializing our variables at the beginning and let us declare a new variable. Of course, my bar keyword, I think we can just call this variable "score." If it state block, so that is a safe variable. Now, before I set it equal to something, let us also type that as a number and we will set its initial value to zero. Now, we can make use of that by first of all, let us go down in here and update our score every time we successfully hit a bubble. So, we have already got the unload movie set into there. Our sound pop is starting, we will update our score so we will just say score plus, plus, remember that increments are valued by one.
Now, obviously, if you want it to increment it by five or something like that, you can just simply add that on at that point. But not only do we want to update the score, we also want to update the display of the score in the score window. We can do that pretty easily by just accessing that dynamic textile that we have made, txt score, we are going to be modifying the text property and we will set it equal to our score value. And if we wanted to be absolutely correct, I am just going to use our string function, so, I will just put that in parenthesis real quick. I will type string so it is converted into a string type of a character and we will have it finished off. Now, let us test that to make sure our score is working properly. I will start up a new game; we are getting bubbles without even hitting anything. There we go. And you can see that each pop is accompanied by a change in the score window. Now, probably last if I just hit the button again, you can see that we have not done anything to reset the score.
So, it is probably a very last thing that I would do to make this resemble a real game would be to reset the score each time we hit the new game button. I also take the opportunity to set a starting position for a pin maybe down here in the display field so that when you first start up a game that word is going to set. We will cover those last two things. I will close up my preview window and we will just go up to where we start a game off.
Now, I am just going to look for that function. There it is all the way at the bottom where we handle our start button. You can see we loop through and make a bubble and what I could with this point is actually modify our score value or reset it equal to zero and since I can see this one right here, I will just copy that off because as we reset our value, we want to redisplay the zero value into the field.
Now, to setup the starting position for the pin, we can do that at the beginning of the movie by simply going out to the stage and moving its starting location. So, I will close my action script panel and we will z
Pretty simple to put sounds in, we just need to designate where they are going to start. Now, if I wanted to add scoring to the movie, I would generally do it in the same place. Once we have verified that we have actually hit a bubble and popped it,...
click to read more