summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/index.html2
-rw-r--r--docs/index.pckbin1933540 -> 1933940 bytes
-rw-r--r--docs/index.service.worker.js2
-rw-r--r--player.gd12
-rw-r--r--root.tscn1
5 files changed, 14 insertions, 3 deletions
diff --git a/docs/index.html b/docs/index.html
index 0b7ea7c..936d42e 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -112,7 +112,7 @@ body {
<script src="index.js"></script>
<script>
-const GODOT_CONFIG = {"args":[],"canvasResizePolicy":2,"emscriptenPoolSize":8,"ensureCrossOriginIsolationHeaders":false,"executable":"index","experimentalVK":false,"fileSizes":{"index.pck":1933540,"index.wasm":38034280},"focusCanvas":true,"gdextensionLibs":[],"godotPoolSize":4,"serviceWorker":"index.service.worker.js"};
+const GODOT_CONFIG = {"args":[],"canvasResizePolicy":2,"emscriptenPoolSize":8,"ensureCrossOriginIsolationHeaders":false,"executable":"index","experimentalVK":false,"fileSizes":{"index.pck":1933940,"index.wasm":38034280},"focusCanvas":true,"gdextensionLibs":[],"godotPoolSize":4,"serviceWorker":"index.service.worker.js"};
const GODOT_THREADS_ENABLED = false;
const engine = new Engine(GODOT_CONFIG);
diff --git a/docs/index.pck b/docs/index.pck
index 177f54d..aba560f 100644
--- a/docs/index.pck
+++ b/docs/index.pck
Binary files differ
diff --git a/docs/index.service.worker.js b/docs/index.service.worker.js
index b5be385..3c96be4 100644
--- a/docs/index.service.worker.js
+++ b/docs/index.service.worker.js
@@ -4,7 +4,7 @@
// Incrementing CACHE_VERSION will kick off the install event and force
// previously cached resources to be updated from the network.
/** @type {string} */
-const CACHE_VERSION = '1763108177|14024774539';
+const CACHE_VERSION = '1763109853|15701222846';
/** @type {string} */
const CACHE_PREFIX = 'MobileMetroidvan-sw-cache-';
const CACHE_NAME = CACHE_PREFIX + CACHE_VERSION;
diff --git a/player.gd b/player.gd
index 4fce64e..cc2a663 100644
--- a/player.gd
+++ b/player.gd
@@ -2,10 +2,15 @@ extends CharacterBody2D
@export var speed: float
@export var jump_strength: float
+@export var coyote_max: int
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
var prev_dir: float = 0.0
+# coyote = 0 indicates on floor
+# coyote > 0 indicates frames since on floor
+var coyote: int = 0
+
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
@@ -26,8 +31,13 @@ func _process(_delta: float) -> void:
func _physics_process(delta: float):
velocity.y += gravity * delta
+ if is_on_floor():
+ coyote = 0
+ else:
+ coyote += 1
- if Input.is_action_just_pressed("jump") and is_on_floor():
+ var can_jump = coyote < coyote_max
+ if Input.is_action_just_pressed("jump") and can_jump:
velocity.y = -jump_strength
var direction: float
diff --git a/root.tscn b/root.tscn
index 08bd841..e7b7206 100644
--- a/root.tscn
+++ b/root.tscn
@@ -448,6 +448,7 @@ position = Vector2(90, 64)
collision_layer = 2
speed = 70.0
jump_strength = 320.0
+coyote_max = 10
[node name="Camera2D" type="Camera2D" parent="Player"]
position = Vector2(0, -15)