Skip to content
This repository has been archived by the owner on May 27, 2023. It is now read-only.

Commit

Permalink
Try for hitboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
HoldYourWaffle committed Jun 14, 2018
1 parent b5da0e1 commit 722057d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions core/src/main/java/info/zthings/geem/main/GameplayState.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.decals.CameraGroupStrategy;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.TimeUtils;
import com.badlogic.gdx.utils.Timer;
import com.badlogic.gdx.utils.Timer.Task;
Expand Down Expand Up @@ -199,7 +198,7 @@ public void update(float dt) {
if (ship.position.x < -xb) ship.position.x = -xb;
else if (ship.position.x > xb) ship.position.x = xb;

final Vector3 vecBuf = new Vector3();
//final Vector3 vecBuf = new Vector3();
for (Asteroid a : obstacles) {
if (a.position.x < -xb || a.position.x > xb) continue;

Expand All @@ -217,8 +216,8 @@ public void update(float dt) {
GeemLoop.getRC().ass.get("sfx/oof.wav", Sound.class).play(.8F);
continue;
} else for (Bullet b : bullets) {
vecBuf.set(b.position.x, a.getCurrentBounds().getCenterY(), b.position.z);
if (a.getCurrentBounds().contains(vecBuf)) {
//vecBuf.set(b.position.x, a.getCurrentBounds().getCenterY(), b.position.z);
if (a.getCurrentBounds().intersects(b.getCurrentBounds())) {
b.destroyed = true;
float dist = a.position.z - ship.position.z;
GeemLoop.getRC().ass.get("sfx/biem.wav", Sound.class).play((dist < 60 ? 1 - dist / 60 : 0) * .8F);
Expand Down

0 comments on commit 722057d

Please sign in to comment.