|
|
Flash dodge ball game part 7 getting pointsIn this tutorial we will add a point score, move a object to random places with time sequence, pretty cool and easy features for games. 1. Now you see that the walls we made in lesson 4 is shown, we want to hide them, so select all the wall movie clips, right click and choose distribute to layers, and place those layers beneath the grass layer. 2. 3. var dorandom = function(){ Now what this does is to pick a random number between 0 and 430 for the x axis and a random number between 0 and 380 for the y axis and then place the strawberry at that position every 5000 mil seconds (5 sec). 4. 5. onClipEvent (enterFrame) { _root.point._x = random(450) The onClipEvent(enterFrame) we have been using before in a previous lesson, so you should know what its function is. Now we tell flash that if our character joe hits the strawberry then it should add 1 to the score text field (_root.board.score_text.text) and remember when adding numbers together we need to put the fields in a Number(something) field. At last we give the strawberry a new position so we don't repeat getting points at the same spot for 5 seconds. Finally our game is done, I know this is a very big tutorial in 7 lessons, but I did it over 7 lessons just to keep it basic so even newbies should be able to follow it. Part 1 Part 2 Part 3 Part 4 Part 5 Part 6 Part 7 |






