Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void collisionCheck() {
- for (GeometricObject geo : geos) {
- // Das hier sieht gut aus, beide Faelle abgedeck
- if (geo.corner.x + geo.width >= getWidth() || geo.corner.x <= 0) {
- geo.velocity.x = geo.velocity.x * -1;
- }
- // Das hier sieht auch gut aus, auch beide Faelle abgedeck
- if (geo.corner.y + geo.height >= getHeight() || geo.corner.y <= 0) {
- geo.velocity.y = geo.velocity.y * -1;
- }
- for (GeometricObject geox : geos) {
- // Das hier ist komisch? Die klammern sind falsch? in deinem equals body befindet sich nichts.
- if (!geo.equals(geox)) {
- }
- // Der swap an sich seht aber gut aus
- if (geo.touches(geox)) {
- Vertex tmp = geo.velocity;
- geo.velocity = geox.velocity;
- geox.velocity = tmp;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement