Hello!
I need help with a ball colliding correctly with a square on stage. This is the file: https://app.box.com/s/ui4q15juyp9iqszmm95g
It’s basically a ball bouncing of four walls and hitting 2 object incorrectly. Because there is a quite a bit of code relevant to the ball hitting the walls I am only posting the code for the object on the main timeline.
var ballXSpeed:Number = 8;//X Speed of the Ball
var ballYSpeed:Number = 8;//Y Speed of the Ball
mcBall.addEventListener(Event.ENTER_FRAME, moveBall);
function moveBall(event:Event):void {
mcBall.x += ballXSpeed;//Move the ball horizontally
mcBall.y += ballYSpeed;//Move the ball vertically
and inside the object (brick .as)
if (this.hitTestObject(_main.mcBall))
{
_main.ballYSpeed *= -1;
What code do I need to change inside brick .as to fix this?
Thanks!