mirror of
https://github.com/Dejvino/roadtrip
synced 2024-11-16 13:42:35 +00:00
Remapped keys to WASDX.
This commit is contained in:
parent
29d4f312d1
commit
2a4cc65a81
@ -6,7 +6,7 @@ A game about a journey involving vehicles and obstacles.
|
|||||||
## Status
|
## Status
|
||||||
### DONE
|
### DONE
|
||||||
* Physics-based vehicles
|
* Physics-based vehicles
|
||||||
* Driving controls (UHJKM)
|
* Driving controls (WASDX)
|
||||||
* Enter / Exit a car (Enter)
|
* Enter / Exit a car (Enter)
|
||||||
* Camera following the player
|
* Camera following the player
|
||||||
* Hilly ground
|
* Hilly ground
|
||||||
|
@ -70,7 +70,7 @@ public class RoadTrip extends SimpleApplication implements ActionListener {
|
|||||||
addMap();
|
addMap();
|
||||||
|
|
||||||
DirectionalLight dl = new DirectionalLight();
|
DirectionalLight dl = new DirectionalLight();
|
||||||
dl.setColor(ColorRGBA.White);
|
dl.setColor(ColorRGBA.LightGray);
|
||||||
dl.setDirection(new Vector3f(1, -1, 1));
|
dl.setDirection(new Vector3f(1, -1, 1));
|
||||||
rootNode.addLight(dl);
|
rootNode.addLight(dl);
|
||||||
|
|
||||||
@ -95,13 +95,15 @@ public class RoadTrip extends SimpleApplication implements ActionListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setupKeys() {
|
private void setupKeys() {
|
||||||
inputManager.addMapping("Lefts", new KeyTrigger(KeyInput.KEY_H));
|
inputManager.clearMappings();
|
||||||
inputManager.addMapping("Rights", new KeyTrigger(KeyInput.KEY_K));
|
inputManager.addMapping("Lefts", new KeyTrigger(KeyInput.KEY_A));
|
||||||
inputManager.addMapping("Ups", new KeyTrigger(KeyInput.KEY_U));
|
inputManager.addMapping("Rights", new KeyTrigger(KeyInput.KEY_D));
|
||||||
inputManager.addMapping("Downs", new KeyTrigger(KeyInput.KEY_J));
|
inputManager.addMapping("Ups", new KeyTrigger(KeyInput.KEY_W));
|
||||||
inputManager.addMapping("Revs", new KeyTrigger(KeyInput.KEY_M));
|
inputManager.addMapping("Downs", new KeyTrigger(KeyInput.KEY_S));
|
||||||
|
inputManager.addMapping("Revs", new KeyTrigger(KeyInput.KEY_X));
|
||||||
inputManager.addMapping("Space", new KeyTrigger(KeyInput.KEY_SPACE));
|
inputManager.addMapping("Space", new KeyTrigger(KeyInput.KEY_SPACE));
|
||||||
inputManager.addMapping("Reset", new KeyTrigger(KeyInput.KEY_RETURN));
|
inputManager.addMapping("Reset", new KeyTrigger(KeyInput.KEY_RETURN));
|
||||||
|
inputManager.addMapping("Esc", new KeyTrigger(KeyInput.KEY_ESCAPE));
|
||||||
inputManager.addListener(this, "Lefts");
|
inputManager.addListener(this, "Lefts");
|
||||||
inputManager.addListener(this, "Rights");
|
inputManager.addListener(this, "Rights");
|
||||||
inputManager.addListener(this, "Ups");
|
inputManager.addListener(this, "Ups");
|
||||||
@ -109,6 +111,7 @@ public class RoadTrip extends SimpleApplication implements ActionListener {
|
|||||||
inputManager.addListener(this, "Revs");
|
inputManager.addListener(this, "Revs");
|
||||||
inputManager.addListener(this, "Space");
|
inputManager.addListener(this, "Space");
|
||||||
inputManager.addListener(this, "Reset");
|
inputManager.addListener(this, "Reset");
|
||||||
|
inputManager.addListener(this, "Esc");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCar()
|
private void addCar()
|
||||||
@ -276,7 +279,7 @@ public class RoadTrip extends SimpleApplication implements ActionListener {
|
|||||||
|
|
||||||
vehicle.addControl(vehicleControl);
|
vehicle.addControl(vehicleControl);
|
||||||
getPhysicsSpace().add(vehicleControl);
|
getPhysicsSpace().add(vehicleControl);
|
||||||
vehicleControl.setPhysicsLocation(new Vector3f(10f + (float)Math.random() * 20f, 30f, 12f + (float)Math.random() * 20f));
|
vehicleControl.setPhysicsLocation(new Vector3f(10f + (float)Math.random() * 40f, 28f, 12f + (float)Math.random() * 40f));
|
||||||
|
|
||||||
vehicles.add(vehicle);
|
vehicles.add(vehicle);
|
||||||
rootNode.attachChild(vehicle);
|
rootNode.attachChild(vehicle);
|
||||||
@ -458,6 +461,9 @@ public class RoadTrip extends SimpleApplication implements ActionListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (binding.equals("Esc")) {
|
||||||
|
stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Node addPerson() {
|
private Node addPerson() {
|
||||||
|
Loading…
Reference in New Issue
Block a user