aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortslil clingman <>2021-09-26 21:30:04 -0400
committertslil clingman <>2021-09-26 21:32:03 -0400
commit72dcaf8b2f811d0d1525592b2a1a63327b2fbc7a (patch)
tree2753747493ba8a3079c434c8fddb294a62f883c7
parent8ddc801e21bb02d0de20351f692b48e2e19c94c4 (diff)
remap controls
-rw-r--r--src/main.zig19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/main.zig b/src/main.zig
index 2f3c189..5754793 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -67,7 +67,7 @@ pub fn main() !void {
var window = try sf.RenderWindow.create(.{ .x = constants.ScreenWidth, .y = constants.ScreenHeight }, 32, "zirc", sf.window.Style.none);
defer window.destroy();
- window.setFramerateLimit(60);
+ window.setFramerateLimit(40);
// Load the background skybox, really `skycylinder', and assign it to a
// sprite -- it's set to repeating so that it goes on forever. We need to
@@ -116,13 +116,12 @@ pub fn main() !void {
}
if (isKeyPressed(.Escape)) window.close();
-
if (isKeyPressed(.C)) player.height -= 0.1;
if (isKeyPressed(.V)) player.height += 0.1;
- const rotation = 2.0 * PI / 100.0;
- if (isKeyPressed(.R)) player.ang += rotation;
- if (isKeyPressed(.T)) player.ang -= rotation;
+ const rotation = 2.0 * PI / 200.0;
+ if (isKeyPressed(.Left)) player.ang += rotation;
+ if (isKeyPressed(.Right)) player.ang -= rotation;
const cos = std.math.cos(player.ang);
const sin = std.math.sin(player.ang);
@@ -130,14 +129,14 @@ pub fn main() !void {
player.acc_x = 0;
player.acc_y = 0;
const acc_mag = 30;
- if (isKeyPressed(.Right)) {
- player.acc_x += sin;
- player.acc_y -= cos;
- }
- if (isKeyPressed(.Left)) {
+ if (isKeyPressed(.R)) {
player.acc_x -= sin;
player.acc_y += cos;
}
+ if (isKeyPressed(.T)) {
+ player.acc_x += sin;
+ player.acc_y -= cos;
+ }
if (isKeyPressed(.Up) or isKeyPressed(.F)) {
player.acc_x += cos;
player.acc_y += sin;