-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81f69f0
commit 1a7bbe8
Showing
7 changed files
with
79 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
res://scenes/mainmenu.tscn | ||
res://mainmenu.gd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,65 @@ | ||
extends Control | ||
|
||
class World: | ||
var label: String | ||
var x: int | ||
|
||
func _init(initial_label: String): | ||
self.label = initial_label | ||
self.x = 0 | ||
@onready var world_1 = $MarginContainer2/World1 | ||
@onready var world_4 = $MarginContainer2/World4 | ||
@onready var world_2 = $MarginContainer2/World2 | ||
@onready var world_3 = $MarginContainer2/World3 | ||
|
||
var middle_index: int | ||
var animation_duration: float | ||
var animation_step: float | ||
|
||
func animate_sliding(direction: String): | ||
if direction == "right": | ||
_start_animation_right() | ||
|
||
var worlds = [world_1, world_2, world_3, world_4] | ||
var world_indices = {world_1: 1, world_2: 2, world_3: 3, world_4: 4} | ||
var animation_in_progress = false | ||
|
||
func _start_animation_right(): | ||
animation_in_progress = true | ||
for world in worlds: | ||
if world_indices[world] == 4: | ||
world_indices[world] = 1 | ||
else: | ||
world_indices[world] += 1 | ||
for world in worlds: | ||
if world_indices[world] == 1: | ||
world.set_position(Vector2(-185, 0)) | ||
world.show() | ||
elif world_indices[world] == 2: | ||
world.set_position(Vector2(0, 0)) | ||
world.show() | ||
elif world_indices[world] == 3: | ||
world.set_position(Vector2(185, 0)) | ||
world.show() | ||
elif world_indices[world] == 4: | ||
world.set_position(Vector2(185, 0)) | ||
world.hide() | ||
animation_in_progress = false | ||
|
||
func _on_play_pressed(): | ||
get_tree().change_scene_to_file("res://scenes/game.tscn") | ||
|
||
|
||
func _on_options_pressed(): | ||
get_tree().change_scene_to_file("res://scenes/optionsmenu.tscn") | ||
|
||
|
||
get_tree().change_scene_to_file("res://scenes/optionsmenu.tscn") | ||
|
||
func _on_exit_pressed(): | ||
get_tree().quit() | ||
|
||
func _input(event: InputEvent): | ||
if event is InputEventKey: | ||
if Input.is_action_just_pressed("ui_right") and not animation_in_progress: | ||
print("gay") | ||
animate_sliding("right") | ||
elif Input.is_action_just_pressed("ui_left") and not animation_in_progress: | ||
print("work") | ||
animate_sliding("left") |