Compare commits

..

No commits in common. "04dc2595684ecee8b300eb1beaedb310e40c031d" and "23e4bc717f9c083a156836cc1e53365d5d185d01" have entirely different histories.

5 changed files with 17 additions and 36 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 KiB

After

Width:  |  Height:  |  Size: 80 KiB

44
main.gd
View file

@ -45,8 +45,7 @@ func _process(delta: float) -> void:
$UndoButton.disabled = not hist.has_undo() $UndoButton.disabled = not hist.has_undo()
$RedoButton.disabled = not hist.has_redo() $RedoButton.disabled = not hist.has_redo()
$RestartButton.disabled = not hist.has_undo() $RestartButton.disabled = not hist.has_undo()
$Clock.text = "T = %d\n%d FPS\n%f hold time\n%f arrf" % \ $Clock.text = "T = %d\n%d FPS" % [time, Engine.get_frames_per_second()]
[time, Engine.get_frames_per_second(), move_hold_time, arrf(move_hold_time)]
var slowmo := Input.is_action_pressed("slowmo"); var slowmo := Input.is_action_pressed("slowmo");
$SlowmoIndicator.text = "slowmo" if slowmo else "" $SlowmoIndicator.text = "slowmo" if slowmo else ""
Engine.time_scale = slowmo_speed if slowmo else 1.0 Engine.time_scale = slowmo_speed if slowmo else 1.0
@ -54,38 +53,17 @@ func _process(delta: float) -> void:
AudioServer.playback_speed_scale = slowmo_speed if slowmo else 1.0 AudioServer.playback_speed_scale = slowmo_speed if slowmo else 1.0
if not $TopLeft.is_on_screen() or not $BottomRight.is_on_screen(): if not $TopLeft.is_on_screen() or not $BottomRight.is_on_screen():
camera.position.y += 10*delta camera.position.y += 10*delta
handle_move(delta)
var move_last := Vector2i.ZERO func _input(event: InputEvent) -> void:
var move_hold_time := 0.0 if event.is_action_pressed("u", false, true):
var move_last_integer := -1 step(Vector2i.UP)
elif event.is_action_pressed("d", false, true):
func arrf(x: float) -> float: step(Vector2i.DOWN)
return 5*x**(4.0/3) elif event.is_action_pressed("l", false, true):
#return 20*x*log(x+1)/log(10) step(Vector2i.LEFT)
elif event.is_action_pressed("r", false, true):
func handle_move(delta: float): step(Vector2i.RIGHT)
var dir := Vector2i(Input.get_vector(&"l", &"r", &"u", &"d").snapped(Vector2.ONE)) elif event.is_action_pressed("undo", false, true):
if dir == Vector2i.ZERO or (abs(dir.x) > 0 and abs(dir.y) > 0):
move_last = Vector2i.ZERO
move_hold_time = 0
move_last_integer = -1
return
var fx := floori(arrf(move_hold_time))
if fmod(arrf(move_hold_time), 1) < 0.1 and fx != move_last_integer:
var steps := maxi(1, fx - move_last_integer)
for i in range(steps):
step(dir)
move_last_integer = fx
move_last = dir
move_hold_time += delta
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("undo", false, true):
undo() undo()
elif event.is_action_pressed("redo", false, true): elif event.is_action_pressed("redo", false, true):
redo() redo()

View file

@ -1,7 +1,11 @@
[gd_resource type="SphereMesh" load_steps=2 format=3 uid="uid://bxuewsvlsvexw"] [gd_resource type="SphereMesh" load_steps=3 format=3 uid="uid://bxuewsvlsvexw"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_yae82"]
size = Vector2(100, 100)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_yae82"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_yae82"]
albedo_color = Color(0.997528, 0.415884, 0.114771, 1) albedo_color = Color(0.997528, 0.415884, 0.114771, 1)
albedo_texture = SubResource("PlaceholderTexture2D_yae82")
[resource] [resource]
material = SubResource("StandardMaterial3D_yae82") material = SubResource("StandardMaterial3D_yae82")

View file

@ -121,7 +121,7 @@ func do_bump(move: Vector2i, old_lvel := lvel) -> Callable:
tweens.push_back(tween) tweens.push_back(tween)
# TODO?: maybe fix? maybe the bump should be more complicated? # TODO?: maybe fix? maybe the bump should be more complicated?
func undo_bump(_move: Vector2i) -> Callable: func undo_bump(move: Vector2i) -> Callable:
return func(): pass return func(): pass
func _ready() -> void: func _ready() -> void:

View file

@ -106,7 +106,6 @@ wait={
slowmo={ slowmo={
"deadzone": 0.2, "deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":77,"key_label":0,"unicode":109,"location":0,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":77,"key_label":0,"unicode":109,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":true,"script":null)
] ]
} }