class mass { float px, py, vx, vy, ax, ay, mass, fx, fy; void update() { vx += fx / mass + const_gravityx; vy += fy / mass + const_gravityy; px += vx; py += vy; fx = 0; fy = 0; vx *= const_friction; vy *= const_friction; if (px < 0) { px = 0; vx *= -const_bounce; } if (py < 0) { py = 0; vy *= -const_bounce; } if (px >= width) { px = width - 1; vx *= -const_bounce; } if (py >= height) { py = height - 1; vy *= -const_bounce; } } /* void mouse() { } void noMouse() { } */ }