View Single Post
Old 03-24-2009, 01:32 PM   PM User | #3
Cmptr_Prgrmr2B
New Coder

 
Join Date: Jan 2009
Posts: 15
Thanks: 1
Thanked 0 Times in 0 Posts
Cmptr_Prgrmr2B is an unknown quantity at this point
I fixed part of my code like you posted, and went looking for a way to bounce the ball ad different angles. In my original code, this

Code:
ball.checkPaddles = function() {
	if (ball.hitTest(player)) {
	ball.dx = -ball.dx;
	ball.dy = getDy(player);
	}
	if (ball.hitTest(opp)) {
		ball.dx = -ball.dx;
		ball.dy = getDy(opp);
	}
}

function getDy(paddle) {
	relY = ball._y - paddle._y;
	relPerc - relY / paddle._height;
	trace ("relPerc");
	
	newDy = relPerc * 30;
	trace("NewDy");
	return newDy;
	
}
should have done it. For some reason it did not. Can you please look at this code as well?
Cmptr_Prgrmr2B is offline   Reply With Quote