PDA

View Full Version : [AS3] Bouncing Ball game


David Lindh
07-29-2009, 09:37 AM
Hello,
I'm under construction of my first flash game and have some questions.

First of all here is a link to the game (http://www.lindh.pp.se/flash/ballGame.html).

Control the ball sideways with left and right arrow on the keyboard. Make the ball bounce by pressing the down key when the ball is falling.

My first question is, what do you think is the best way to solve this game.

Right now i have 2 things to control the ball, 1 class that calculating the movments and one ball movieclip that I pass the X and Y values from class.
It feels like it posible to create one class that calculates the movment and displays the ball.
The same things goes to the enemies.

David Lindh
07-29-2009, 11:17 AM
Made some progress on the ball class. Now it extends the functionality from movieClip and displays both the ball and the shadow.
I also started on a new solution to create the enemies.

I updated the code in the first post with the new one.

David Lindh
07-29-2009, 12:05 PM
With the new enemy class im down to 99 lines of code in the main timeline. :)

David Lindh
07-29-2009, 02:28 PM
Now I made a menu to choose difficulty.
The first frame is the menu and on the second frame the game begins. When the ball hits something Im going back to frame 1 but i get this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at ballGame_fla::MainTimeline/frame1()
at flash.display::MovieClip/gotoAndStop()
at ballGame_fla::MainTimeline/finishLevel()
at ballGame_fla::MainTimeline/frameloop()
TypeError: Error #1010: A term is undefined and has no properties.
at ballGame_fla::MainTimeline/frameloop()

David Lindh
09-14-2009, 12:05 PM
Today I finally took the time to complete my game.

Here is the final game. (http://www.lindh.pp.se/flash/ballGame.html)

tango88
09-16-2009, 07:47 AM
Hey, cool, you got a nice smooth bouncing motion.

I had to learn a few words of (Swedish?) to navigate.;)