Skip to content

Commit

Permalink
played with pathing variables for better smoother pathing
Browse files Browse the repository at this point in the history
  • Loading branch information
1000monkeys committed Jun 15, 2020
1 parent dc998e9 commit 3dd4ac4
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 29 deletions.
Binary file modified .gradle/5.4.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/5.4.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/5.4.1/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/javaCompile/classAnalysis.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/javaCompile/jarAnalysis.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/javaCompile/javaCompile.lock
Binary file not shown.
Binary file modified .gradle/5.4.1/javaCompile/taskHistory.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
44 changes: 24 additions & 20 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class Constants {
* The debug variable, used in certain areas of the code to make debugging easier,
* For release this variable should always be false.
*/
public static boolean DEBUG = true;
public static boolean DEBUG = false;

/**
* Non diagonal movement cost(diagonal being 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static enum SteeringState {WANDER,SEEK,FLEE,ARRIVE,NONE} // a list of po

// Steering data
float maxLinearSpeed = 64f; // stores the max speed the entity can go
float maxLinearAcceleration = 64f; // stores the max acceleration
float maxLinearAcceleration = 640f; // stores the max acceleration
float maxAngularSpeed = 45f; // the max turning speed
float maxAngularAcceleration = 45f;// the max turning acceleration
float zeroThreshold = 0.1f; // how accurate should checks be (0.0000001f will mean the entity must get within 0.0000001f of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,27 @@ protected void processEntity(Entity entity, float deltaTime) {

route = new Array<>(path.getCount());
for (int i = 0; i < path.getCount(); i++) {
route.add(new Vector2(path.get(i).getFromNode().getX() * 16 + 8, path.get(i).getFromNode().getY() * 16 + 8));
route.add(new Vector2(path.get(i).getToNode().getX() * 16 + 8, path.get(i).getToNode().getY() * 16 + 8));
System.out.println("Added to path: " + i + " X:" + (path.get(i).getToNode().getX() * 16 + 8) + " Y:" + (path.get(i).getToNode().getY() * 16 + 8));
}

if (path.getCount() > 1) {
LinePath<Vector2> linePath = new LinePath<Vector2>(route);
//steer.steeringBehavior = SteeringPresets.getFollowPath(steer, linePath);
steer.currentMode = SteeringComponent.SteeringState.ARRIVE;
steer.steeringBehavior = SteeringPresets.getArrive(steer, new SeekablePoint(route.get(count).x, route.get(count).y));
steer.steeringBehavior = SteeringPresets.getSeek(steer, new SeekablePoint(route.get(count).x, route.get(count).y));
System.out.println("APPLIED STEERING");
}
}else{
if ( route.size - 1 > count &&
route.get(count).x + 8 > monsterBody.getPosition().x && monsterBody.getPosition().x > route.get(count).x - 8 &&
route.get(count).y + 8 > monsterBody.getPosition().y && monsterBody.getPosition().y > route.get(count).y - 8
route.get(count).x + 8 > monsterBody.getPosition().x - 4 && monsterBody.getPosition().x + 4 > route.get(count).x - 8 &&
route.get(count).y + 8 > monsterBody.getPosition().y - 4 && monsterBody.getPosition().y + 4 > route.get(count).y - 8
){
count++;
//steer.body.setLinearVelocity(new Vector2(0, 0));
//steer.body.setAngularVelocity(0F);
steer.body.setLinearVelocity(new Vector2(0, 0));
steer.body.setAngularVelocity(0F);
steer.currentMode = SteeringComponent.SteeringState.ARRIVE;
steer.steeringBehavior = SteeringPresets.getArrive(steer, new SeekablePoint(route.get(count).x, route.get(count).y));
steer.steeringBehavior = SteeringPresets.getSeek(steer, new SeekablePoint(route.get(count).x, route.get(count).y));
}
}

Expand Down

0 comments on commit 3dd4ac4

Please sign in to comment.