public void setPosition() { Ball.setVelocity(new Vector2(0, 0)); // Set velocity from ball to 0 Ball.setPosition( new Vector2( 2040 / 2 - (100 / 2), 1360 - 190 - 100)); // Set the position from the bal in the middle of the screen SpriteHome.setPositionX(250 + 20); // Set the position from the sprite SpriteHome.setPositionY(1360 - 200 - 190); // Set the position from the sprite }
void testHelper(Position position, Velocity velocity, Tester stepTest) { DummyPhysics physics = new DummyPhysics(); physics.createGoalpost(Direction.NORTH); physics.createGoalpost(Direction.SOUTH); Ball ball = physics.createBall(); ball.setPosition(position); ball.setVelocity(velocity); for (int i = 0; i < 1000; i++) { physics.step(dt); stepTest.test(ball.getPosition(), ball.getVelocity()); } physics.clean(); }