Then imported them to the stage, and converted them to symbols and made sure I exported the bubble to actionscript so I could delete it from the stage and call it when it was needed in the game.
I did the coding in various stages once I had all the components in the game.
I began by making the fish move using the arrow keys. This was quite tricky and took me a while to complete as I kept getting error messages up but I found a couple of websites that gave me some tips and I eventually worked out how to complete it. Looking back at the code now I can see how it would all fit together and using the websites helped me to understand the way the script works a bit better and made the rest of the coding slightly easier.
Once I had the fish moving around the screen I decided to move onto the bubble. At the start I wasn't quite sure what I wanted to do with the bubble, whether I wanted loads to appear and the player had to go round popping them all, or whether I wanted the bubble to appear once and the player had to go and pop it then move on to wherever the next bubble appeared. I thought the second idea was better as I could incorporate a better scoring system into the game so I decided on this as the final idea. We'd done a similar idea in the tutorial in class so I used some of this code but changed it so that it worked when the fish was controlled by the arrow keys. This took some time to do and I had to play around with the code a bit before I managed to get it all working.
After this it was time to play around with the collision counter and the scoring system. We hadn't done this in class so I had a bit of trouble trying to work out how to make the counter increase in the score box when the fish hit the bubbles, but once I had worked out how to do it I realised it was really easy.
I used a dynamic text box named scoreTxt and made it so that when the fish hit the bubble the score increased by one, score++. I coded the timer as well to make sure it counted down from 30 seconds and went to the next keyframe and made sure that it displays the score properly.
I added in the sound of a bubble popping when the fish gets the bubble to make the game a bit more appealing.





No comments:
Post a Comment