# AS3 Classes, Collisions and Functions

**URL:** https://forum.kirupa.com/t/as3-classes-collisions-and-functions/314882
**Category:** flash
**Created:** [October 11, 2010, 9:05pm UTC](https://forum.kirupa.com/t/as3-classes-collisions-and-functions/314882 "2010-10-11T21:05:35Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![DerekJ](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@DerekJ](https://forum.kirupa.com/u/DerekJ)
#### Post date: [October 11, 2010, 9:05pm UTC](https://forum.kirupa.com/t/as3-classes-collisions-and-functions/314882/1 "2010-10-11T21:05:35Z")

</div>

Hi,

Im working in FlashDevelop on a ‘breakout’ game where you control a paddle with your mouse and a ball bounces around the screen and breaks blocks.

Right now I have a Main, Paddle, and Ball class. In the main class I added a Paddle called player as a public static variable. In my Ball class I have a collisionCheck() function. This way I can access ‘player’ from within my Ball class for testing collisions.

At somepoint in the game there will be a powerup that adds mutiple balls to the stage. Right now I have a function in the main class call addBall() to add a new Ball to the stage.

I am now running into trouble. Working on the collision check method in my Ball class, I dont know how to check if a ball is hitting another ball because as of right now, balls are being added with the addBall function, so they can’t be declared as public static variables. 😕

I included the .as files as attachments. This is my first game in as3. Maybe I am going about creating this in the wrong way, I am open to big changes. Can anyone help??
