Skip to content

Commit 1d8e288

Browse files
committed
allow fullscreen button, also correct goober x-axis movement to 0.5 units exactly
1 parent c05a551 commit 1d8e288

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/game/game.gd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ func _ready():
3737
audio.play()
3838
audio.finished.connect(audio.play)
3939

40+
func _input(event):
41+
if event.is_action_pressed("ui_fullscreen"):
42+
var win_full = DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN
43+
DisplayServer.mouse_set_mode(DisplayServer.MOUSE_MODE_VISIBLE if win_full else DisplayServer.MOUSE_MODE_HIDDEN)
44+
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED if win_full else DisplayServer.WINDOW_MODE_FULLSCREEN)
45+
46+
4047
func _process(delta):
4148
map_clock.x += delta
4249
# title screen is the first level, and "game complete" screen is the last level:

src/game/goober.gd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class_name Goober
66

77
var game
88
var spd := 30.0
9-
var vel := Vector2(spd, 1)
9+
var vel := Vector2(spd, 0)
1010
var flip_clock := 1.0
1111

1212
func _enter_tree():
@@ -27,7 +27,9 @@ func _physics_process(delta):
2727
if !raycast.is_colliding():
2828
flip()
2929

30-
velocity = vel
30+
31+
move_and_collide(Vector2(0, 1))
32+
velocity = Vector2(vel.x, 0)
3133
move_and_slide()
3234
if velocity.x == 0:
3335
flip()

0 commit comments

Comments
 (0)