Author SHA1 Message Date
riley bea9044aee Merge pull request 'Added grassy tiles' (#3) from feat-procedural-gen into main
Release / Export Game (push) Successful in 1m47s
Reviewed-on: #3
2026-06-14 15:22:30 +02:00
qwsdcvghyu89 62f61acc10 Fixed cancellation logic; added double jump max fall speed property.
Release / Export Game (push) Successful in 2m3s
2026-06-14 21:29:15 +10:00
qwsdcvghyu89 4e344cc02d Fixed run affecting air speed bug; fixed auto zeroing of velocities bug.
Release / Export Game (push) Successful in 2m49s
2026-06-14 20:56:06 +10:00
riley a0c4e305c5 Merge pull request 'merging dynamic lighting features to main' (#2) from feat-procedural-gen into main
Release / Export Game (push) Successful in 1m45s
Reviewed-on: #2
2026-06-14 12:09:55 +02:00
5 changed files with 22 additions and 14 deletions
+7
View File
@@ -0,0 +1,7 @@
{
"sdk": {
"version": "11.0.100-preview.5.26302.115",
"allowPrerelease": true,
"rollForward": "latestPatch"
}
}
+2 -2
View File
@@ -217,7 +217,7 @@ script = ExtResource("2_oekxy")
WalkAcceleration = 30.0 WalkAcceleration = 30.0
StoppingDeceleration = 50.0 StoppingDeceleration = 50.0
CancellationAcceleration = 50.0 CancellationAcceleration = 50.0
AirAcceleration = 9.0 AirAcceleration = 3.0
MaxFallSpeed = 50.0 MaxFallSpeed = 50.0
MaxRiseSpeed = 50.0 MaxRiseSpeed = 50.0
MaxRunSpeed = 12.0 MaxRunSpeed = 12.0
@@ -238,7 +238,7 @@ sprite_frames = ExtResource("2_wq5k4")
animation = &"walk" animation = &"walk"
[node name="Camera2D" type="Camera2D" parent="Player/CharacterBody2D" unique_id=1068565115] [node name="Camera2D" type="Camera2D" parent="Player/CharacterBody2D" unique_id=1068565115]
zoom = Vector2(5, 5) zoom = Vector2(2, 2)
[node name="Label" type="Label" parent="Player/CharacterBody2D" unique_id=436935745] [node name="Label" type="Label" parent="Player/CharacterBody2D" unique_id=436935745]
offset_left = 22.0 offset_left = 22.0
+1
View File
@@ -11,6 +11,7 @@ config_version=5
[application] [application]
config/name="WrplatGodot" config/name="WrplatGodot"
config/version="0.1.38"
run/main_scene="uid://r2lb1ommvj6u" run/main_scene="uid://r2lb1ommvj6u"
config/features=PackedStringArray("4.6", "C#", "Forward Plus") config/features=PackedStringArray("4.6", "C#", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"
+11 -12
View File
@@ -35,6 +35,10 @@ public partial class PlayerPhysicsController : CharacterBody2D {
private float MaxRunSpeed { get; set; } = 16f; private float MaxRunSpeed { get; set; } = 16f;
[Export] [Export]
private float MaxWalkSpeed { get; set; } = 8f; private float MaxWalkSpeed { get; set; } = 8f;
[Export]
private float MaxAirSpeed { get; set; } = 16f;
[Export]
private float MaxDoubleJumpFallSpeed { get; set; } = 1f;
[ExportCategory("Objects")] [ExportCategory("Objects")]
[Export] [Export]
@@ -65,7 +69,7 @@ public partial class PlayerPhysicsController : CharacterBody2D {
[Export] [Export]
public float Deadzone { get; set; } = 0.1f; public float Deadzone { get; set; } = 0.1f;
public float GetMinAccel(float delta) => CancellationAcceleration * delta;
private float _lv = 0.0f; private float _lv = 0.0f;
@@ -125,8 +129,6 @@ public partial class PlayerPhysicsController : CharacterBody2D {
float velx = (Velocity.X / UnitToPx); float velx = (Velocity.X / UnitToPx);
float vely = (Velocity.Y / UnitToPx) + Gravity * (float)delta; float vely = (Velocity.Y / UnitToPx) + Gravity * (float)delta;
if (Mathf.Abs(velx) < 0.1) velx = 0;
var grounded = this.IsOnFloor(); var grounded = this.IsOnFloor();
var coyoteGrounded = _timeOffGround < CoyoteTiming; var coyoteGrounded = _timeOffGround < CoyoteTiming;
if (grounded || coyoteGrounded) { if (grounded || coyoteGrounded) {
@@ -193,7 +195,7 @@ public partial class PlayerPhysicsController : CharacterBody2D {
} }
} }
if (Input.IsActionJustPressed("jump") && Mathf.Abs(vely) < 2) { if (Input.IsActionJustPressed("jump") && Mathf.Abs(vely) < MaxDoubleJumpFallSpeed) {
vely = -_lv; vely = -_lv;
} }
@@ -206,16 +208,13 @@ public partial class PlayerPhysicsController : CharacterBody2D {
else velx += autostop; else velx += autostop;
} }
var maxXSpeed = Input.IsActionPressed("run") ? MaxRunSpeed : MaxWalkSpeed; var maxXSpeed = grounded ? Input.IsActionPressed("run") ? MaxRunSpeed : MaxWalkSpeed : MaxAirSpeed;
var maxYSpeed = vely > 0 ? MaxFallSpeed : MaxRiseSpeed; var maxYSpeed = vely > 0 ? MaxFallSpeed : MaxRiseSpeed;
var (absvelx, absvely) = (Mathf.Abs(velx), Mathf.Abs(vely)); var (absvelx, absvely) = (Mathf.Abs(velx), Mathf.Abs(vely));
float xcancel = 0, ycancel = 0; if (absvelx > maxXSpeed)
if (absvelx > maxXSpeed) xcancel = -Math.Sign(velx) * CancellationAcceleration * (float)delta; velx = Mathf.Sign(velx) * Mathf.Max(absvelx - CancellationAcceleration * (float)delta, maxXSpeed);
if (absvely > maxYSpeed) ycancel = -Math.Sign(vely) * CancellationAcceleration * (float)delta; if (absvely > maxYSpeed)
if (Mathf.Abs(xcancel) + 0.1 > absvelx) velx = 0; vely = Mathf.Sign(vely) * Mathf.Max(absvely - CancellationAcceleration * (float)delta, maxYSpeed);
else velx += xcancel;
if (Mathf.Abs(ycancel) + 0.1 > absvely) vely = 0;
else vely += ycancel;
DebugTextLabel.Text = DebugTextLabel.Text =
$"grounded: {grounded}\n" + $"grounded: {grounded}\n" +
+1
View File
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
#nullable enable #nullable enable
public class LevelPattern { public class LevelPattern {
public TileMapPattern Level { get; } public TileMapPattern Level { get; }