diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2022-09-14 10:35:49 -0400 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2022-09-15 08:57:23 -0400 |
commit | cdb6dc3ff78516bdc1b10c2f02ac50973969b749 (patch) | |
tree | 97e144fc1034c123bcd2fffa0e356fba82f8ffb9 /World.gd | |
parent | 79b829e35ae65e3c046e7081aeb2557242e93d24 (diff) | |
download | godot_wildjam_49-cdb6dc3ff78516bdc1b10c2f02ac50973969b749.tar.gz godot_wildjam_49-cdb6dc3ff78516bdc1b10c2f02ac50973969b749.zip |
Pilot ship with arrow keys
Diffstat (limited to 'World.gd')
-rw-r--r-- | World.gd | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/World.gd b/World.gd new file mode 100644 index 0000000..09b8e85 --- /dev/null +++ b/World.gd @@ -0,0 +1,16 @@ +extends RigidBody + +export var acceleration = 10.0; + +func travel(direction:Vector3): + var boat_direction = $"/root/Main/Raft".global_transform.basis + boat_direction = Basis(Vector3.UP*boat_direction.get_euler().y) + direction = -direction + direction = boat_direction * direction + direction = direction.normalized() + self.add_central_force(direction*acceleration) + +func _integrate_forces(_state): + var stick = Input.get_axis("ship_down","ship_up") + if stick != 0.0: + travel(Vector3.FORWARD*stick) |