diff --git a/Characters/Player.tscn b/Characters/Player.tscn deleted file mode 100755 index 39464a0..0000000 --- a/Characters/Player.tscn +++ /dev/null @@ -1,10 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://Assets/tmp.png" type="Texture" id=1] - -[node name="Player" type="Node2D"] -script = ExtResource( 1 ) - -[node name="Sprite" type="Sprite" parent="."] -scale = Vector2( 3.34375, 3.03125 ) -texture = ExtResource( 1 ) diff --git a/Characters/Villain.gd b/Characters/Scripts/Villain.gd similarity index 89% rename from Characters/Villain.gd rename to Characters/Scripts/Villain.gd index a39b596..18e9057 100755 --- a/Characters/Villain.gd +++ b/Characters/Scripts/Villain.gd @@ -13,20 +13,20 @@ var next = false # Called when the node enters the scene tree for the first time. -func _ready(): +func _ready() -> void: rng.randomize() reset_timer() me.play(animations[0]) -func reset_timer(): +func reset_timer() -> void: timer = 0 limit_random = rng.randi_range(2, 10) # Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): +func _process(delta) -> void: timer += delta var max_frame = me.frames.get_frame_count(me.animation) - 1 @@ -39,7 +39,7 @@ func _process(delta): # Jump to next animation at the end of the current one -func check_next_animframe(max_frame, next_animation): +func check_next_animframe(max_frame, next_animation) -> void: if me.frame == 0 and next: me.play(next_animation) next = false diff --git a/Characters/Villain.tscn b/Characters/Villain.tscn index 0798e2a..ab45d6c 100755 --- a/Characters/Villain.tscn +++ b/Characters/Villain.tscn @@ -3,7 +3,7 @@ [ext_resource path="res://Assets/oeil/0.png" type="Texture" id=1] [ext_resource path="res://Assets/oeil/1.png" type="Texture" id=2] [ext_resource path="res://Assets/oeil/3.png" type="Texture" id=3] -[ext_resource path="res://Characters/Villain.gd" type="Script" id=4] +[ext_resource path="res://Characters/Scripts/Villain.gd" type="Script" id=4] [ext_resource path="res://Assets/oeil/4.png" type="Texture" id=5] [ext_resource path="res://Assets/oeil/5.png" type="Texture" id=6] [ext_resource path="res://Assets/oeil/6.png" type="Texture" id=7] diff --git a/Elements/Directory.tscn b/Elements/Directory.tscn new file mode 100755 index 0000000..e84d704 --- /dev/null +++ b/Elements/Directory.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://Assets/tmp.png" type="Texture" id=1] +[ext_resource path="res://Elements/Scripts/Directory.gd" type="Script" id=2] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 16, 16 ) + +[node name="Node2D" type="Node2D"] + +[node name="Sprite" type="Sprite" parent="."] +texture = ExtResource( 1 ) + +[node name="Area2D" type="Area2D" parent="."] +script = ExtResource( 2 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +shape = SubResource( 1 ) + +[connection signal="mouse_entered" from="Area2D" to="Area2D" method="_on_Area2D_mouse_entered"] +[connection signal="mouse_exited" from="Area2D" to="Area2D" method="_on_Area2D_mouse_exited"] diff --git a/Elements/Scripts/Directory.gd b/Elements/Scripts/Directory.gd new file mode 100755 index 0000000..119dc73 --- /dev/null +++ b/Elements/Scripts/Directory.gd @@ -0,0 +1,11 @@ +extends Area2D + + +func _on_Area2D_mouse_entered() -> void: + print("coucou") + Input.set_default_cursor_shape(Input.CURSOR_POINTING_HAND) + + +func _on_Area2D_mouse_exited() -> void: + print("bye") + Input.set_default_cursor_shape(Input.CURSOR_ARROW) diff --git a/Scenes/DesktopScreen.tscn b/Scenes/DesktopScreen.tscn index 55d1fa2..14d4c33 100755 --- a/Scenes/DesktopScreen.tscn +++ b/Scenes/DesktopScreen.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=10 format=2] [ext_resource path="res://Characters/Villain.tscn" type="PackedScene" id=1] -[ext_resource path="res://Characters/Player.tscn" type="PackedScene" id=2] -[ext_resource path="res://Scenes/Button_Node2D.gd" type="Script" id=3] +[ext_resource path="res://Elements/Directory.tscn" type="PackedScene" id=2] +[ext_resource path="res://Scenes/Scripts/Button_Node2D.gd" type="Script" id=3] [ext_resource path="res://Assets/tres_button/normal.tres" type="StyleBox" id=4] [ext_resource path="res://Assets/tres_button/pressed.tres" type="StyleBox" id=5] [ext_resource path="res://Assets/tres_button/hover.tres" type="StyleBox" id=6] @@ -13,10 +13,11 @@ [node name="Node2D" type="Node2D"] -[node name="Player" parent="." instance=ExtResource( 2 )] +[node name="Windows" type="Sprite" parent="."] visible = false -position = Vector2( 719, 386 ) -script = null +position = Vector2( 512, 358 ) +z_index = -3 +texture = ExtResource( 7 ) [node name="Button" type="Button" parent="."] margin_left = 431.0 @@ -24,7 +25,8 @@ margin_top = 349.0 margin_right = 651.0 margin_bottom = 386.0 theme = SubResource( 1 ) -custom_colors/font_color = Color( 0.27451, 0.207843, 0.207843, 1 ) +custom_colors/font_color_disabled = Color( 0, 0, 0, 1 ) +custom_colors/font_color = Color( 0.34902, 0.313726, 0.313726, 1 ) custom_fonts/font = ExtResource( 8 ) custom_styles/hover = ExtResource( 6 ) custom_styles/pressed = ExtResource( 5 ) @@ -36,10 +38,24 @@ script = ExtResource( 3 ) position = Vector2( 871, 589 ) scale = Vector2( 0.2, 0.2 ) -[node name="Windows" type="Sprite" parent="."] -visible = false -position = Vector2( 512, 358 ) -z_index = -3 -texture = ExtResource( 7 ) +[node name="Directories" type="Node2D" parent="."] + +[node name="Directory1" parent="Directories" instance=ExtResource( 2 )] +position = Vector2( 40, 130 ) + +[node name="Directory2" parent="Directories" instance=ExtResource( 2 )] +position = Vector2( 40, 180 ) + +[node name="Directory3" parent="Directories" instance=ExtResource( 2 )] +position = Vector2( 40, 230 ) + +[node name="Directory4" parent="Directories" instance=ExtResource( 2 )] +position = Vector2( 40, 280 ) + +[node name="Directory5" parent="Directories" instance=ExtResource( 2 )] +position = Vector2( 40, 330 ) + +[node name="Directory6" parent="Directories" instance=ExtResource( 2 )] +position = Vector2( 40, 380 ) [connection signal="pressed" from="Button" to="Button" method="_on_Button_pressed"] diff --git a/Scenes/GameOver.gd b/Scenes/GameOver.gd deleted file mode 100755 index 6fba334..0000000 --- a/Scenes/GameOver.gd +++ /dev/null @@ -1,5 +0,0 @@ -extends Node2D - - -func _on_RestartButton_pressed(): - get_tree().change_scene("res://Scenes/Menu.tscn") diff --git a/Scenes/Screen_Menu.gd b/Scenes/Screen_Menu.gd deleted file mode 100755 index 42187fc..0000000 --- a/Scenes/Screen_Menu.gd +++ /dev/null @@ -1,13 +0,0 @@ -extends Control - - -func _on_PlayButton_pressed(): - get_tree().change_scene("res://Scenes/DesktopScreen.tscn") - - -func _on_Help_Button_pressed(): - print("help me") - - -func _on_Quit_Button_pressed(): - get_tree().quit() diff --git a/Scenes/Button_Node2D.gd b/Scenes/Scripts/Button_Node2D.gd similarity index 83% rename from Scenes/Button_Node2D.gd rename to Scenes/Scripts/Button_Node2D.gd index e68b9d0..d74e6bc 100755 --- a/Scenes/Button_Node2D.gd +++ b/Scenes/Scripts/Button_Node2D.gd @@ -9,13 +9,13 @@ const texture_released = preload("res://Assets/skin_assets/button_pressed.png") # Called every frame. '_delta' is the elapsed time since the previous frame. -func _process(_delta): +func _process(_delta) -> void: if etat: if villain.animation == villain_animations[-1]: - get_tree().change_scene("res://Scenes/GameOver.tscn") + assert(get_tree().change_scene("res://Scenes/GameOver.tscn") == OK) -func _on_Button_pressed(): +func _on_Button_pressed() -> void: etat = !etat var new_stylebox_normal = self.get_stylebox("normal").duplicate() if etat: diff --git a/Scenes/Scripts/GameOver.gd b/Scenes/Scripts/GameOver.gd new file mode 100755 index 0000000..bb005ce --- /dev/null +++ b/Scenes/Scripts/GameOver.gd @@ -0,0 +1,5 @@ +extends Node2D + + +func _on_RestartButton_pressed() -> void: + assert(get_tree().change_scene("res://Scenes/Menu.tscn") == OK) diff --git a/Scenes/Scripts/Screen_Menu.gd b/Scenes/Scripts/Screen_Menu.gd new file mode 100755 index 0000000..61ac7e8 --- /dev/null +++ b/Scenes/Scripts/Screen_Menu.gd @@ -0,0 +1,13 @@ +extends Control + + +func _on_PlayButton_pressed() -> void: + assert(get_tree().change_scene("res://Scenes/DesktopScreen.tscn") == OK) + + +func _on_Help_Button_pressed() -> void: + print("help me") + + +func _on_Quit_Button_pressed() -> void: + get_tree().quit() diff --git a/Scenes/gameover.tscn b/Scenes/gameover.tscn index 9d959a2..f95c28d 100755 --- a/Scenes/gameover.tscn +++ b/Scenes/gameover.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=7 format=2] -[ext_resource path="res://Scenes/GameOver.gd" type="Script" id=1] +[ext_resource path="res://Scenes/Scripts/GameOver.gd" type="Script" id=1] [ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=2] [ext_resource path="res://Assets/tres_button/normal.tres" type="StyleBox" id=3] [ext_resource path="res://Assets/tres_button/pressed.tres" type="StyleBox" id=4] diff --git a/Scenes/menu.tscn b/Scenes/menu.tscn index 5dd75f7..1f24059 100755 --- a/Scenes/menu.tscn +++ b/Scenes/menu.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=7 format=2] -[ext_resource path="res://Scenes/Screen_Menu.gd" type="Script" id=1] +[ext_resource path="res://Scenes/Scripts/Screen_Menu.gd" type="Script" id=1] [ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=2] [ext_resource path="res://Assets/tres_button/normal.tres" type="StyleBox" id=3] [ext_resource path="res://Assets/tres_button/pressed.tres" type="StyleBox" id=4]