From 158a13fff7a6a9e8c7f021068731b489ae126b95 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 28 Jan 2024 16:37:50 +0100 Subject: [PATCH] Pair + weather --- ressources/assets/Pair/Card_1_V2.png.import | 34 +++++++++ ressources/assets/Pair/Card_2_V2.png.import | 34 +++++++++ ressources/assets/Pair/Card_3_V2.png.import | 34 +++++++++ ressources/assets/Pair/Card_4_V2.png.import | 34 +++++++++ ressources/assets/Pair/Card_5_V2.png.import | 34 +++++++++ .../assets/Pair/Pair_Wallpaper.png.import | 34 +++++++++ .../assets/Weather/Ads_Wallpaper.png.import | 34 +++++++++ ressources/assets/Weather/CloudyV2.png.import | 34 +++++++++ ressources/assets/Weather/RainyV2.png.import | 34 +++++++++ ressources/assets/Weather/SunnyV2.png.import | 34 +++++++++ scenes/game/ads/Ads_pair.tscn | 52 ++++++++++++++ scenes/game/ads/Ads_weather.tscn | 48 +++++++++++++ scripts/ads/ads_pair.gd | 69 +++++++++++++++++++ scripts/ads/ads_weather.gd | 26 +++++++ 14 files changed, 535 insertions(+) create mode 100644 ressources/assets/Pair/Card_1_V2.png.import create mode 100644 ressources/assets/Pair/Card_2_V2.png.import create mode 100644 ressources/assets/Pair/Card_3_V2.png.import create mode 100644 ressources/assets/Pair/Card_4_V2.png.import create mode 100644 ressources/assets/Pair/Card_5_V2.png.import create mode 100644 ressources/assets/Pair/Pair_Wallpaper.png.import create mode 100644 ressources/assets/Weather/Ads_Wallpaper.png.import create mode 100644 ressources/assets/Weather/CloudyV2.png.import create mode 100644 ressources/assets/Weather/RainyV2.png.import create mode 100644 ressources/assets/Weather/SunnyV2.png.import create mode 100644 scenes/game/ads/Ads_pair.tscn create mode 100644 scenes/game/ads/Ads_weather.tscn create mode 100644 scripts/ads/ads_pair.gd create mode 100644 scripts/ads/ads_weather.gd diff --git a/ressources/assets/Pair/Card_1_V2.png.import b/ressources/assets/Pair/Card_1_V2.png.import new file mode 100644 index 0000000..eb63a9a --- /dev/null +++ b/ressources/assets/Pair/Card_1_V2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dpjtj3nt0baup" +path="res://.godot/imported/Card_1_V2.png-ce08af098badb5de76a85f8b7529278e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ressources/assets/Pair/Card_1_V2.png" +dest_files=["res://.godot/imported/Card_1_V2.png-ce08af098badb5de76a85f8b7529278e.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/ressources/assets/Pair/Card_2_V2.png.import b/ressources/assets/Pair/Card_2_V2.png.import new file mode 100644 index 0000000..a85b8eb --- /dev/null +++ b/ressources/assets/Pair/Card_2_V2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://pnvisfgb5vrj" +path="res://.godot/imported/Card_2_V2.png-9fc031e159da7ccd87c1148f3b2a2f8b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ressources/assets/Pair/Card_2_V2.png" +dest_files=["res://.godot/imported/Card_2_V2.png-9fc031e159da7ccd87c1148f3b2a2f8b.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/ressources/assets/Pair/Card_3_V2.png.import b/ressources/assets/Pair/Card_3_V2.png.import new file mode 100644 index 0000000..268e388 --- /dev/null +++ b/ressources/assets/Pair/Card_3_V2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c03p400ff8cx3" +path="res://.godot/imported/Card_3_V2.png-4f7684045695ce0d2cced82bbb09d968.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ressources/assets/Pair/Card_3_V2.png" +dest_files=["res://.godot/imported/Card_3_V2.png-4f7684045695ce0d2cced82bbb09d968.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/ressources/assets/Pair/Card_4_V2.png.import b/ressources/assets/Pair/Card_4_V2.png.import new file mode 100644 index 0000000..ea8ea97 --- /dev/null +++ b/ressources/assets/Pair/Card_4_V2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://diygbm6s7gbk1" +path="res://.godot/imported/Card_4_V2.png-0fc0260f1889a2a898ff19b7ce96572d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ressources/assets/Pair/Card_4_V2.png" +dest_files=["res://.godot/imported/Card_4_V2.png-0fc0260f1889a2a898ff19b7ce96572d.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/ressources/assets/Pair/Card_5_V2.png.import b/ressources/assets/Pair/Card_5_V2.png.import new file mode 100644 index 0000000..cb8047e --- /dev/null +++ b/ressources/assets/Pair/Card_5_V2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dkn7pvxgei8jx" +path="res://.godot/imported/Card_5_V2.png-5972528a67e9351d2f69f4306fce06a5.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ressources/assets/Pair/Card_5_V2.png" +dest_files=["res://.godot/imported/Card_5_V2.png-5972528a67e9351d2f69f4306fce06a5.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/ressources/assets/Pair/Pair_Wallpaper.png.import b/ressources/assets/Pair/Pair_Wallpaper.png.import new file mode 100644 index 0000000..ecc91d2 --- /dev/null +++ b/ressources/assets/Pair/Pair_Wallpaper.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cifihmb2t0c24" +path="res://.godot/imported/Pair_Wallpaper.png-4a33211791c8b311da0e2949dd13b119.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ressources/assets/Pair/Pair_Wallpaper.png" +dest_files=["res://.godot/imported/Pair_Wallpaper.png-4a33211791c8b311da0e2949dd13b119.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/ressources/assets/Weather/Ads_Wallpaper.png.import b/ressources/assets/Weather/Ads_Wallpaper.png.import new file mode 100644 index 0000000..0400d73 --- /dev/null +++ b/ressources/assets/Weather/Ads_Wallpaper.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dvhevmohr428k" +path="res://.godot/imported/Ads_Wallpaper.png-55bb6356086e282b3f189aae98346045.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ressources/assets/Weather/Ads_Wallpaper.png" +dest_files=["res://.godot/imported/Ads_Wallpaper.png-55bb6356086e282b3f189aae98346045.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/ressources/assets/Weather/CloudyV2.png.import b/ressources/assets/Weather/CloudyV2.png.import new file mode 100644 index 0000000..1d53939 --- /dev/null +++ b/ressources/assets/Weather/CloudyV2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bbc67hdcgn432" +path="res://.godot/imported/CloudyV2.png-6b290d6dfde4bf8f20b312706d3133cc.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ressources/assets/Weather/CloudyV2.png" +dest_files=["res://.godot/imported/CloudyV2.png-6b290d6dfde4bf8f20b312706d3133cc.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/ressources/assets/Weather/RainyV2.png.import b/ressources/assets/Weather/RainyV2.png.import new file mode 100644 index 0000000..737909c --- /dev/null +++ b/ressources/assets/Weather/RainyV2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://41k3rsd3g5ff" +path="res://.godot/imported/RainyV2.png-35ca1de7233295d04333e66256ed3881.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ressources/assets/Weather/RainyV2.png" +dest_files=["res://.godot/imported/RainyV2.png-35ca1de7233295d04333e66256ed3881.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/ressources/assets/Weather/SunnyV2.png.import b/ressources/assets/Weather/SunnyV2.png.import new file mode 100644 index 0000000..8322a20 --- /dev/null +++ b/ressources/assets/Weather/SunnyV2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bkhje4vph4130" +path="res://.godot/imported/SunnyV2.png-c49c6a18d16e4531047372054c470a6b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ressources/assets/Weather/SunnyV2.png" +dest_files=["res://.godot/imported/SunnyV2.png-c49c6a18d16e4531047372054c470a6b.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_pair.tscn b/scenes/game/ads/Ads_pair.tscn new file mode 100644 index 0000000..24b9784 --- /dev/null +++ b/scenes/game/ads/Ads_pair.tscn @@ -0,0 +1,52 @@ +[gd_scene load_steps=4 format=3 uid="uid://6w0rs55km8nm"] + +[ext_resource type="PackedScene" uid="uid://n06gkookqeml" path="res://scenes/game/windows/Ads.tscn" id="1_07a7e"] +[ext_resource type="Script" path="res://scripts/ads/ads_pair.gd" id="2_3kwqw"] +[ext_resource type="Texture2D" uid="uid://cifihmb2t0c24" path="res://ressources/assets/Pair/Pair_Wallpaper.png" id="3_jn4tm"] + +[node name="Windows" instance=ExtResource("1_07a7e")] +script = ExtResource("2_3kwqw") + +[node name="PairWallpaper" type="Sprite2D" parent="." index="2"] +position = Vector2(250.5, 222.25) +scale = Vector2(0.400833, 0.344271) +texture = ExtResource("3_jn4tm") + +[node name="GridContainer" type="GridContainer" parent="PairWallpaper" index="0"] +offset_left = -560.0 +offset_top = -471.0 +offset_right = 538.0 +offset_bottom = 429.0 +scale = Vector2(1.265, 1.265) +columns = 3 + +[node name="Button1" type="Button" parent="PairWallpaper/GridContainer" index="0"] +layout_mode = 2 +focus_mode = 0 + +[node name="Button2" type="Button" parent="PairWallpaper/GridContainer" index="1"] +layout_mode = 2 +focus_mode = 0 + +[node name="Button3" type="Button" parent="PairWallpaper/GridContainer" index="2"] +layout_mode = 2 +focus_mode = 0 + +[node name="Button4" type="Button" parent="PairWallpaper/GridContainer" index="3"] +layout_mode = 2 +focus_mode = 0 + +[node name="Button5" type="Button" parent="PairWallpaper/GridContainer" index="4"] +layout_mode = 2 +focus_mode = 0 + +[node name="Button6" type="Button" parent="PairWallpaper/GridContainer" index="5"] +layout_mode = 2 +focus_mode = 0 + +[connection signal="pressed" from="PairWallpaper/GridContainer/Button1" to="." method="_on_pressed" binds= [0]] +[connection signal="pressed" from="PairWallpaper/GridContainer/Button2" to="." method="_on_pressed" binds= [1]] +[connection signal="pressed" from="PairWallpaper/GridContainer/Button3" to="." method="_on_pressed" binds= [2]] +[connection signal="pressed" from="PairWallpaper/GridContainer/Button4" to="." method="_on_pressed" binds= [3]] +[connection signal="pressed" from="PairWallpaper/GridContainer/Button5" to="." method="_on_pressed" binds= [4]] +[connection signal="pressed" from="PairWallpaper/GridContainer/Button6" to="." method="_on_pressed" binds= [5]] diff --git a/scenes/game/ads/Ads_weather.tscn b/scenes/game/ads/Ads_weather.tscn new file mode 100644 index 0000000..8c05e92 --- /dev/null +++ b/scenes/game/ads/Ads_weather.tscn @@ -0,0 +1,48 @@ +[gd_scene load_steps=4 format=3 uid="uid://bikwjtkpti0g4"] + +[ext_resource type="PackedScene" uid="uid://n06gkookqeml" path="res://scenes/game/windows/Ads.tscn" id="1_qk8kk"] +[ext_resource type="Script" path="res://scripts/ads/ads_weather.gd" id="2_qi53i"] +[ext_resource type="Texture2D" uid="uid://dvhevmohr428k" path="res://ressources/assets/Weather/Ads_Wallpaper.png" id="3_26kab"] + +[node name="Windows" instance=ExtResource("1_qk8kk")] +script = ExtResource("2_qi53i") + +[node name="ColorRect2" parent="Panel2" index="0"] +offset_left = -2.0 +offset_top = 0.0 +offset_right = -2.0 +offset_bottom = 354.0 + +[node name="Fond" type="Sprite2D" parent="." index="2"] +position = Vector2(250.5, 224) +scale = Vector2(0.400833, 0.35) +texture = ExtResource("3_26kab") + +[node name="GridContainer" type="GridContainer" parent="Fond" index="0"] +offset_left = -573.0 +offset_top = -477.0 +offset_right = 619.0 +offset_bottom = 470.0 +scale = Vector2(1.245, 1.245) +theme_override_constants/h_separation = 20 +columns = 3 + +[node name="Image1" type="Button" parent="Fond/GridContainer" index="0"] +layout_mode = 2 +size_flags_horizontal = 0 +focus_mode = 0 +flat = true + +[node name="Image2" type="Button" parent="Fond/GridContainer" index="1"] +layout_mode = 2 +focus_mode = 0 +flat = true + +[node name="Image3" type="Button" parent="Fond/GridContainer" index="2"] +layout_mode = 2 +focus_mode = 0 +flat = true + +[connection signal="pressed" from="Fond/GridContainer/Image1" to="." method="_on_pressed" binds= [1]] +[connection signal="pressed" from="Fond/GridContainer/Image2" to="." method="_on_pressed" binds= [2]] +[connection signal="pressed" from="Fond/GridContainer/Image3" to="." method="_on_pressed" binds= [3]] diff --git a/scripts/ads/ads_pair.gd b/scripts/ads/ads_pair.gd new file mode 100644 index 0000000..8560c85 --- /dev/null +++ b/scripts/ads/ads_pair.gd @@ -0,0 +1,69 @@ +extends "res://scripts/ads/ads_default.gd" + +var hold := [-1, -1] # current selection +var correct := [-1, -1] # good selection +var alterne := false # change la valeur de gauche ou de droite + +@onready var image1 := $PairWallpaper/GridContainer/Button1 +@onready var image2 := $PairWallpaper/GridContainer/Button2 +@onready var image3 := $PairWallpaper/GridContainer/Button3 +@onready var image4 := $PairWallpaper/GridContainer/Button4 +@onready var image5 := $PairWallpaper/GridContainer/Button5 +@onready var image6 := $PairWallpaper/GridContainer/Button6 + +var buttons +var images + +func _ready(): + buttons = [image1, image2, image3, image4, image5, image6] + images = [ load("res://ressources/assets/Pair/Card_1_V2.png") + , load("res://ressources/assets/Pair/Card_2_V2.png") + , load("res://ressources/assets/Pair/Card_3_V2.png") + , load("res://ressources/assets/Pair/Card_4_V2.png") + , load("res://ressources/assets/Pair/Card_5_V2.png") ] + var selection = images.pick_random() + images.push_back(selection) + images.shuffle() + + for i in range(0, images.size()): + if images[i] == selection: + if correct[0] == -1: + correct[0] = i + else: + correct[1] = i + break + + + # Apply texture to buttons + for i in range(0, buttons.size()): + buttons[i].icon = images[i] + +func exit_condition(): + return condition + +func _on_pressed(num): + # Click reset + if hold[0] == num: + hold[0] = -1 + if hold[1] == num: + hold[1] = -1 + + # Click rotation + if alterne: + # Droit + hold[1] = num + else: + # Gauche + hold[0] = num + + # Verification + condition = hold[0] == correct[0] and hold[1] == correct[1] + + # Alternation + alterne = !alterne + + # Reset colors + for i in range(0, buttons.size()): + buttons[i].icon = images[i] + + # TODO: Color grayscale ou un truc du genre diff --git a/scripts/ads/ads_weather.gd b/scripts/ads/ads_weather.gd new file mode 100644 index 0000000..a26733a --- /dev/null +++ b/scripts/ads/ads_weather.gd @@ -0,0 +1,26 @@ +extends "res://scripts/ads/ads_default.gd" + +@onready var image1 := $Fond/GridContainer/Image1 +@onready var image2 := $Fond/GridContainer/Image2 +@onready var image3 := $Fond/GridContainer/Image3 + +var good_image + +func _ready(): + var images = [ load("res://ressources/assets/Weather/CloudyV2.png") + , load("res://ressources/assets/Weather/RainyV2.png") + , load("res://ressources/assets/Weather/SunnyV2.png") ] + images.shuffle() + for i in range(0, images.size()): + if images[i].resource_path.contains("Sunny"): + good_image = i + 1 + + image1.icon = images[0] + image2.icon = images[1] + image3.icon = images[2] + +func exit_condition(): + return condition + +func _on_pressed(num): + condition = num == good_image