diff --git a/models/menu/PDP.png.import b/models/menu/PDP.png.import new file mode 100644 index 0000000..162d0d0 --- /dev/null +++ b/models/menu/PDP.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://esj5tuyxt4n4" +path="res://.godot/imported/PDP.png-3b4e16e692352ef47d8e45b657730eab.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://models/menu/PDP.png" +dest_files=["res://.godot/imported/PDP.png-3b4e16e692352ef47d8e45b657730eab.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/models/menu/on_off.png.import b/models/menu/on_off.png.import new file mode 100644 index 0000000..2ae942c --- /dev/null +++ b/models/menu/on_off.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://0gd2ishr4j5x" +path="res://.godot/imported/on_off.png-baadc4b97c853551e531032d85bc6f49.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://models/menu/on_off.png" +dest_files=["res://.godot/imported/on_off.png-baadc4b97c853551e531032d85bc6f49.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/models/menu/power_off.png.import b/models/menu/power_off.png.import new file mode 100644 index 0000000..d3866c5 --- /dev/null +++ b/models/menu/power_off.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dayle54j3fk2g" +path="res://.godot/imported/power_off.png-a248ab7ee41195fdf296c8a390d94648.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://models/menu/power_off.png" +dest_files=["res://.godot/imported/power_off.png-a248ab7ee41195fdf296c8a390d94648.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/game/ads/Ads_password.tscn b/scenes/game/ads/Ads_password.tscn new file mode 100644 index 0000000..a5491fa --- /dev/null +++ b/scenes/game/ads/Ads_password.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=3 format=3 uid="uid://cuvb3sbm2nn44"] + +[ext_resource type="PackedScene" uid="uid://n06gkookqeml" path="res://scenes/game/windows/Ads.tscn" id="1_tmtrh"] +[ext_resource type="FontFile" uid="uid://dwgslonlru0ck" path="res://ressources/Battlenet.ttf" id="2_p5m0b"] + +[node name="Windows" instance=ExtResource("1_tmtrh")] + +[node name="RichTextLabel" type="RichTextLabel" parent="." index="2"] +layout_mode = 0 +offset_left = 83.0 +offset_top = 143.0 +offset_right = 270.0 +offset_bottom = 289.0 +theme_override_colors/default_color = Color(0, 0, 0, 1) +theme_override_fonts/normal_font = ExtResource("2_p5m0b") +theme_override_font_sizes/normal_font_size = 61 +text = "password" + +[node name="Timer" parent="." index="3"] +autostart = true diff --git a/scenes/game/ads/Ads_sudoku.tscn b/scenes/game/ads/Ads_sudoku.tscn new file mode 100644 index 0000000..d841ed6 --- /dev/null +++ b/scenes/game/ads/Ads_sudoku.tscn @@ -0,0 +1,19 @@ +[gd_scene load_steps=4 format=3 uid="uid://djap3t7qr0dje"] + +[ext_resource type="PackedScene" uid="uid://n06gkookqeml" path="res://scenes/game/windows/Ads.tscn" id="1_bmr11"] +[ext_resource type="FontFile" uid="uid://dwgslonlru0ck" path="res://ressources/Battlenet.ttf" id="2_606ke"] +[ext_resource type="Script" path="res://scripts/ads/ads_default.gd" id="2_w3vjc"] + +[node name="Windows" instance=ExtResource("1_bmr11")] +script = ExtResource("2_w3vjc") + +[node name="RichTextLabel" type="RichTextLabel" parent="." index="2"] +layout_mode = 0 +offset_left = 83.0 +offset_top = 143.0 +offset_right = 270.0 +offset_bottom = 289.0 +theme_override_colors/default_color = Color(0, 0, 0, 1) +theme_override_fonts/normal_font = ExtResource("2_606ke") +theme_override_font_sizes/normal_font_size = 61 +text = "sudoku" diff --git a/scenes/game/scr918C.tmp b/scenes/game/scr918C.tmp new file mode 100644 index 0000000..f045a55 --- /dev/null +++ b/scenes/game/scr918C.tmp @@ -0,0 +1,104 @@ +[gd_scene load_steps=12 format=3 uid="uid://ur6erv76d2of"] + +[ext_resource type="FontFile" uid="uid://dwgslonlru0ck" path="res://ressources/Battlenet.ttf" id="1_7ecbr"] +[ext_resource type="Script" path="res://scripts/game.gd" id="1_orxmr"] +[ext_resource type="Texture2D" uid="uid://c012k8qiyjn4a" path="res://models/RetroWindowsGUI/RetroWindowsGUI/Windows_Button.png" id="2_j8eab"] +[ext_resource type="Texture2D" uid="uid://ca0n6csxw7yd7" path="res://models/RetroWindowsGUI/RetroWindowsGUI/Windows_Button_Pressed.png" id="3_eb8po"] +[ext_resource type="Texture2D" uid="uid://c1s8gaui8k13h" path="res://models/RetroWindowsGUI/Flag.png" id="4_medxy"] +[ext_resource type="Shader" path="res://shaders/oldscreen.gdshader" id="6_7ta02"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_se4f0"] +bg_color = Color(0.764706, 0.764706, 0.764706, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2mxax"] +draw_center = false +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(1, 1, 1, 1) + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_mbq4w"] +texture = ExtResource("2_j8eab") +texture_margin_left = 2.0 +texture_margin_top = 2.0 +texture_margin_right = 2.0 +texture_margin_bottom = 2.0 +draw_center = false + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_lgpbg"] +texture = ExtResource("3_eb8po") +texture_margin_left = 2.0 +texture_margin_top = 2.0 +texture_margin_right = 2.0 +texture_margin_bottom = 2.0 +draw_center = false + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_lp2yn"] +shader = ExtResource("6_7ta02") +shader_parameter/SCREEN_HEIGHT = 240.0 + +[node name="WindowsDesktop" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_orxmr") + +[node name="ColorRect" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0, 0.45098, 0.509804, 1) + +[node name="Panel" type="Panel" parent="."] +layout_mode = 1 +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -54.0 +grow_horizontal = 2 +grow_vertical = 0 +theme_override_styles/panel = SubResource("StyleBoxFlat_se4f0") + +[node name="Panel" type="Panel" parent="Panel"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -1.0 +offset_right = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_2mxax") + +[node name="Button" type="Button" parent="Panel"] +layout_mode = 0 +offset_left = 4.0 +offset_top = 4.0 +offset_right = 118.0 +offset_bottom = 50.0 +focus_mode = 0 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = ExtResource("1_7ecbr") +theme_override_font_sizes/font_size = 37 +theme_override_styles/normal = SubResource("StyleBoxTexture_mbq4w") +theme_override_styles/hover = SubResource("StyleBoxTexture_lgpbg") +text = "Start" +icon = ExtResource("4_medxy") +expand_icon = true + +[node name="ColorRect2" type="ColorRect" parent="."] +material = SubResource("ShaderMaterial_lp2yn") +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 diff --git a/scenes/game/windows/Windows.tscn b/scenes/game/windows/Ads.tscn similarity index 81% rename from scenes/game/windows/Windows.tscn rename to scenes/game/windows/Ads.tscn index 065468d..e857010 100644 --- a/scenes/game/windows/Windows.tscn +++ b/scenes/game/windows/Ads.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=15 format=3 uid="uid://n06gkookqeml"] +[gd_scene load_steps=17 format=3 uid="uid://n06gkookqeml"] -[ext_resource type="FontFile" uid="uid://dwgslonlru0ck" path="res://ressources/Battlenet.ttf" id="1_3xpen"] -[ext_resource type="Shader" path="res://shaders/oldscreen.gdshader" id="1_dy2m7"] -[ext_resource type="Texture2D" uid="uid://c012k8qiyjn4a" path="res://models/RetroWindowsGUI/RetroWindowsGUI/Windows_Button.png" id="2_cdjsi"] -[ext_resource type="Texture2D" uid="uid://rryuulwvlsqi" path="res://models/RetroWindowsGUI/RetroWindowsGUI/Windows_Button_Inactive.png" id="3_2cafe"] -[ext_resource type="Texture2D" uid="uid://ca0n6csxw7yd7" path="res://models/RetroWindowsGUI/RetroWindowsGUI/Windows_Button_Pressed.png" id="4_aprk7"] +[ext_resource type="Shader" path="res://shaders/oldscreen.gdshader" id="1_1y06m"] +[ext_resource type="Script" path="res://scripts/ads.gd" id="1_ovuv8"] +[ext_resource type="FontFile" uid="uid://dwgslonlru0ck" path="res://ressources/Battlenet.ttf" id="2_ak5sb"] +[ext_resource type="Texture2D" uid="uid://c012k8qiyjn4a" path="res://models/RetroWindowsGUI/RetroWindowsGUI/Windows_Button.png" id="3_ydhup"] +[ext_resource type="Texture2D" uid="uid://rryuulwvlsqi" path="res://models/RetroWindowsGUI/RetroWindowsGUI/Windows_Button_Inactive.png" id="4_qj5eb"] +[ext_resource type="Texture2D" uid="uid://ca0n6csxw7yd7" path="res://models/RetroWindowsGUI/RetroWindowsGUI/Windows_Button_Pressed.png" id="5_kq6ex"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_16my3"] bg_color = Color(0.831373, 0.815686, 0.784314, 1) @@ -29,32 +30,39 @@ texture_margin_right = 0.654032 region_rect = Rect2(0, -1.264, 45.529, 24.719) [sub_resource type="ShaderMaterial" id="ShaderMaterial_y28d3"] -shader = ExtResource("1_dy2m7") +shader = ExtResource("1_1y06m") shader_parameter/SCREEN_HEIGHT = 240.0 [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_8aptj"] -texture = ExtResource("2_cdjsi") +texture = ExtResource("3_ydhup") texture_margin_left = 2.0 texture_margin_top = 2.0 texture_margin_right = 2.0 texture_margin_bottom = 2.0 [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_dlla7"] -texture = ExtResource("3_2cafe") +texture = ExtResource("4_qj5eb") texture_margin_left = 2.0 texture_margin_top = 2.0 texture_margin_right = 2.0 texture_margin_bottom = 2.0 [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_jwtvu"] -texture = ExtResource("4_aprk7") +texture = ExtResource("5_kq6ex") +texture_margin_left = 2.0 +texture_margin_top = 2.0 +texture_margin_right = 2.0 +texture_margin_bottom = 2.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_0cval"] +texture = ExtResource("4_qj5eb") texture_margin_left = 2.0 texture_margin_top = 2.0 texture_margin_right = 2.0 texture_margin_bottom = 2.0 [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_mmcpo"] -texture = ExtResource("2_cdjsi") +texture = ExtResource("3_ydhup") texture_margin_left = 2.0 texture_margin_top = 2.0 texture_margin_right = 2.0 @@ -69,6 +77,7 @@ offset_right = -1100.0 offset_bottom = -500.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_ovuv8") [node name="Panel" type="Panel" parent="."] layout_mode = 1 @@ -114,12 +123,15 @@ offset_right = -4.0 offset_bottom = 42.0 grow_horizontal = 0 theme_override_colors/font_color = Color(0, 0, 0.0392157, 1) -theme_override_fonts/font = ExtResource("1_3xpen") +theme_override_fonts/font = ExtResource("2_ak5sb") theme_override_font_sizes/font_size = 20 theme_override_styles/normal = SubResource("StyleBoxTexture_8aptj") theme_override_styles/hover = SubResource("StyleBoxTexture_dlla7") theme_override_styles/pressed = SubResource("StyleBoxTexture_jwtvu") +theme_override_styles/disabled = SubResource("StyleBoxTexture_0cval") theme_override_styles/focus = SubResource("StyleBoxTexture_mmcpo") text = "X" icon_alignment = 1 expand_icon = true + +[connection signal="pressed" from="Panel2/Button" to="." method="_on_button_pressed"] diff --git a/scenes/game/windows/a.tscn b/scenes/game/windows/Video_page.tscn similarity index 57% rename from scenes/game/windows/a.tscn rename to scenes/game/windows/Video_page.tscn index 364c67a..b3a5e8f 100644 --- a/scenes/game/windows/a.tscn +++ b/scenes/game/windows/Video_page.tscn @@ -1,6 +1,6 @@ -[gd_scene format=3 uid="uid://l50emg1kqw4a"] +[gd_scene format=3 uid="uid://b4ujwtugvmurm"] -[node name="Windows" type="Control"] +[node name="VideoPage" type="Control"] layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 diff --git a/scenes/menu/menu.tscn b/scenes/menu/menu.tscn index 7b761b4..383f623 100644 --- a/scenes/menu/menu.tscn +++ b/scenes/menu/menu.tscn @@ -2,8 +2,8 @@ [ext_resource type="PackedScene" uid="uid://cgdlh6iv2j7we" path="res://scenes/menu/image_menu.tscn" id="1_f4wvw"] [ext_resource type="Script" path="res://scenes/menu/menu.gd" id="1_y4d58"] -[ext_resource type="Texture2D" uid="uid://bcqdrfm52esft" path="res://models/menu/power_off.png" id="2_4yhxu"] -[ext_resource type="Texture2D" uid="uid://plpafbpfkjd7" path="res://models/menu/PDP.png" id="3_a6fh8"] +[ext_resource type="Texture2D" uid="uid://dayle54j3fk2g" path="res://models/menu/power_off.png" id="2_4yhxu"] +[ext_resource type="Texture2D" uid="uid://esj5tuyxt4n4" path="res://models/menu/PDP.png" id="3_a6fh8"] [ext_resource type="FontFile" uid="uid://dwgslonlru0ck" path="res://ressources/Battlenet.ttf" id="3_coatq"] [node name="Menu" type="Node2D"] @@ -35,6 +35,7 @@ texture = ExtResource("3_a6fh8") expand_mode = 1 [node name="Label" type="Label" parent="Menu/NormalStart"] +layout_mode = 0 offset_left = 49.0 offset_top = 2.0 offset_right = 138.0 @@ -49,6 +50,7 @@ theme_type_variation = &"FlatButton" text = " " [node name="pdp2" type="TextureRect" parent="Menu/InfiniteStart"] +layout_mode = 0 offset_top = -4.26229 offset_right = 40.0 offset_bottom = 35.7377 @@ -56,6 +58,7 @@ texture = ExtResource("3_a6fh8") expand_mode = 1 [node name="Label" type="Label" parent="Menu/InfiniteStart"] +layout_mode = 0 offset_left = 49.0 offset_top = 2.0 offset_right = 138.0 @@ -71,6 +74,7 @@ text = " " [node name="pdp3" type="TextureRect" parent="Menu/Options"] +layout_mode = 0 offset_left = 1.0929 offset_top = -4.69944 offset_right = 41.0929 @@ -79,6 +83,7 @@ texture = ExtResource("3_a6fh8") expand_mode = 1 [node name="Label" type="Label" parent="Menu/Options"] +layout_mode = 0 offset_left = 49.0 offset_top = 2.0 offset_right = 138.0 diff --git a/scripts/ads.gd b/scripts/ads.gd new file mode 100644 index 0000000..d3e3b50 --- /dev/null +++ b/scripts/ads.gd @@ -0,0 +1,28 @@ +extends Control + +var condition = false + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass + + + +func exit_condition(): + return condition + +func close(): + if exit_condition(): + self.visible = false + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + close() + + + + +func _on_button_pressed(): + print("pressed") + condition = true diff --git a/scripts/ads/ads_default.gd b/scripts/ads/ads_default.gd new file mode 100644 index 0000000..deca7ca --- /dev/null +++ b/scripts/ads/ads_default.gd @@ -0,0 +1,18 @@ +extends "res://scripts/ads.gd" + + +# Called when the node enters the scene tree for the first time. +func _ready(): + $Panel2/Button.disabled = true + pass + + +func exit_condition(): + return condition + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + close() + +func _on_button_pressed(): + print("pressed") diff --git a/scripts/ads/ads_sudoku.gd b/scripts/ads/ads_sudoku.gd new file mode 100644 index 0000000..276f0db --- /dev/null +++ b/scripts/ads/ads_sudoku.gd @@ -0,0 +1,5 @@ +extends "res://scripts/ads/ads_default.gd" + +func exit_condition(): + return condition + diff --git a/scripts/game.gd b/scripts/game.gd index 32d8b35..8cffcc5 100644 --- a/scripts/game.gd +++ b/scripts/game.gd @@ -1,20 +1,69 @@ extends Control +var ads_scene = [] +var ads = [] +""" +var ads_scene = [preload("res://scenes/game/ads/Ads_password.tscn"), +preload("res://scenes/game/ads/Ads_sudoku.tscn")] +""" -var window = preload("res://scenes/game/windows/Windows.tscn") -var instance = window.instantiate() +func getFilePathsByExtension(directoryPath: String, extension: String) -> Array: + var dir = DirAccess.open(directoryPath) + if !dir : + printerr("Warning: could not open directory: ", directoryPath) + return [] + + var filePaths := [] + if dir: + dir.list_dir_begin() + var fileName = dir.get_next() + while fileName != "": + if dir.current_is_dir(): + print("Found directory: " + fileName) + else: + print("Found file: " + fileName) + if fileName.get_extension() == extension: + var filePath = dir.get_current_dir() + "/" + fileName + filePaths.append(filePath) + fileName = dir.get_next() + else: + print("An error occurred when trying to access the path.") + return filePaths func new_ads(): - instance.position = Vector2(10.0, 5.0) - var _size = instance.get_rect() - print(_size) + print("her") + randomize() + var _range = randi_range(0, ads_scene.size()-1) + var instance = ads_scene[_range].instantiate() add_child(instance) # Replace with function body. + var _scale = Vector2(0.5,0.5) + instance.scale = _scale + var _size = instance.get_size() * _scale + print(_size) + instance.position.x = randf_range(1, get_viewport_rect().size.x - (_size.x)) + instance.position.y = randf_range(1, get_viewport_rect().size.y - (_size.y*1.5)) + ads.push_back(instance) + print(instance.position) # Called when the node enters the scene tree for the first time. +func load_scene(): + var _ads_scene = getFilePathsByExtension("res://scenes/game/ads", "tscn") + for scene in _ads_scene: + ads_scene.push_back(load(scene)) + + func _ready(): - new_ads() + load_scene() + print(ads_scene) + for n in 15: + new_ads() - - +func win(): + for ad in ads: + if ad.visible == true : + return false + return true # Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): - pass +func _process(_delta): + if win(): + pass + print("mettre écran victoire")