10111213141516
public Vec2 pos = new Vec2(); public Vec2 dir = new Vec2(1,1); public int size = 20; public Ball () { pos = new Vec2(1, 0); }
14151617181920
public Ball () { pos = new Vec2(1, 0); } public Ball(int startX, int startY){ pos = new Vec2(startX, startY); }
6768697071727374
newY = ball.dir.y * -1.0; collided = true; } if (collided) { ball.dir = new Vec2(newX, newY); } }
818283848586878889
if (player.pos.intY() < yMin || player.pos.intY() + player.height > yMax) { newY = player.dir.y * -1.0; collided = true; } if (collided) { player.dir = new Vec2(player.dir.x, newY); } }
1213141516171819
@Override public void tick() { super.tick(); if (followBall(60)) { this.dir = new Vec2(dir.x, dir.y * -1.0); } }
26272829303132333435
public boolean isCollided = false; private Logger log = LoggerFactory.getLogger(Goalie.class); public Goalie(int startX, int startY) { pos = new Vec2(startX, startY); this.xMin = startX; this.xMax = startX + width; }
7071727374757677
log.info(this.toString() + ball.toString()); } if (collided) { ball.dir = new Vec2(newX, newY); } }