I would make the ball responsible for checking if it collides with the paddle because the ball's behavior/state will change - not the paddle's, nor does the state of the 'game' really change.
An alternative would be to create a CollissionControler.as that does all your hit testing for you. This may become useful when you add the bricks or other objects that need to check for collisions. -Dan -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Paul Steven Sent: Wednesday, December 13, 2006 8:02 AM To: 'Flashcoders mailing list' Subject: [Flashcoders] AS2 OOP Class Structure for simple pong type game I am creating a simple pong / breakout / arkanoid game in AS2 and not sure how best to deal with the classes. So far I have a Game.as class, a Paddle.as class and a Ball.as class. I need to detect when the ball (or balls) collide with the Paddle. My question is, which class should check for this collision? Should the Game class do this or should I pass a reference to the Paddle into the Ball class so the Ball is able to check this collision itself? If it is the Game class, then I guess it is a case of giving both the Paddle and Ball classes a method to return their current position and then letting the Game class compare these positions to determine if a collision has occurred? If the Ball class needs to have a reference to the Paddle passed to it, I am not sure how this is done. So I would appreciate any advice on this. I appreciate there are probably a lot of different solutions to this, but I am trying to get off on the right footing with this OOP programming. Many thanks Paul _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com This e-mail and its attachments are intended only for the use of the addressee(s) and may contain privileged, confidential or proprietary information. If you are not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution, displaying, copying, or use of this information is strictly prohibited. If you have received this communication in error, please inform the sender immediately and delete and destroy any record of this message. Thank you. _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com