// Description: Update the ball's current position, then erase the old one and draw the // new one... public void UpdateEraseDraw() { position += velocity; if ((position.x > bottomRight.x) || (position.x < topLeft.x)) { velocity.x = (int)(-velocity.x * setup.elasticityWall); position.x += velocity.x; } if ((position.y > bottomRight.y) || (position.y < topLeft.y)) { velocity.y = (int)(-velocity.y * setup.elasticityWall); position.y += velocity.y; } positionSmall = position.MakeSmall(); //Console.WriteLine("Position: {0}", positionSmall); /* * Now erase the old one */ Circle current = shapes[drawIndex]; if (setup.eraseBalls) { current.Draw(graphics, penBlack); } /* * Now draw the new one... */ current.SetOrigin(positionSmall); current.Draw(graphics, penCache[penIndex]); drawIndex++; if (drawIndex == ghostCount) { drawIndex = 0; } }
// Description: Update the ball's current position, then erase the old one and draw the // new one... public void UpdateEraseDraw() { //Console.WriteLine("Pos, vel: {0} {1}", position, velocity); position += velocity; if ((position.X > bottomRight.X) || (position.X < topLeft.X)) { velocity.X = -velocity.X * setup.elasticityWall; position.X += velocity.X; } if ((position.Y > bottomRight.Y) || (position.Y < topLeft.Y)) { velocity.Y = -velocity.Y * setup.elasticityWall; position.Y += velocity.Y; } //Console.WriteLine("Position: {0}", positionSmall); /* * Now erase the old one */ Circle current = shapes[drawIndex]; if (setup.eraseBalls) { current.Draw(graphics, penBlack); } /* * Now draw the new one... */ current.SetOrigin(position); current.Draw(graphics, penCache[penIndex]); drawIndex++; if (drawIndex == ghostCount) { drawIndex = 0; } }