From 3c96d41754dcde4954ab5f56b605490f0d896b42 Mon Sep 17 00:00:00 2001 From: Manal Date: Sun, 28 Jan 2024 19:19:04 +0100 Subject: [PATCH] random --- scenes/game/ads/Ads_normal.tscn | 11 +++++++++++ scenes/game/ads/Ads_sexy_robot.tscn | 4 ++-- scripts/ads/Ads_normal.gd | 21 +++++++++++++++++++++ scripts/ads/ads_default.gd | 3 ++- 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 scenes/game/ads/Ads_normal.tscn create mode 100644 scripts/ads/Ads_normal.gd diff --git a/scenes/game/ads/Ads_normal.tscn b/scenes/game/ads/Ads_normal.tscn new file mode 100644 index 0000000..e19b2de --- /dev/null +++ b/scenes/game/ads/Ads_normal.tscn @@ -0,0 +1,11 @@ +[gd_scene load_steps=3 format=3 uid="uid://wo0ujdthnlrb"] + +[ext_resource type="PackedScene" uid="uid://n06gkookqeml" path="res://scenes/game/windows/Ads.tscn" id="1_6ucwo"] +[ext_resource type="Script" path="res://scripts/ads/Ads_normal.gd" id="2_usogt"] + +[node name="Windows" instance=ExtResource("1_6ucwo")] +script = ExtResource("2_usogt") + +[node name="Sprite2D" type="Sprite2D" parent="." index="2"] +position = Vector2(10, 53) +scale = Vector2(0.4, 0.34) diff --git a/scenes/game/ads/Ads_sexy_robot.tscn b/scenes/game/ads/Ads_sexy_robot.tscn index 21879cf..ee73e0c 100644 --- a/scenes/game/ads/Ads_sexy_robot.tscn +++ b/scenes/game/ads/Ads_sexy_robot.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=3 uid="uid://dgsu5jn00smc8"] +[gd_scene load_steps=8 format=3 uid="uid://cyxifateppwnk"] [ext_resource type="PackedScene" uid="uid://n06gkookqeml" path="res://scenes/game/windows/Ads.tscn" id="1_g6iem"] [ext_resource type="Script" path="res://scripts/ads/Ads_sexy_robot.gd" id="2_17d4p"] @@ -14,7 +14,7 @@ thickness = 20 color = Color(0.823529, 0, 0, 1) thickness = 20 -[node name="Windows" instance=ExtResource("1_g6iem")] +[node name="Windows2" instance=ExtResource("1_g6iem")] script = ExtResource("2_17d4p") [node name="Panel" parent="." index="0"] diff --git a/scripts/ads/Ads_normal.gd b/scripts/ads/Ads_normal.gd new file mode 100644 index 0000000..07961c6 --- /dev/null +++ b/scripts/ads/Ads_normal.gd @@ -0,0 +1,21 @@ +extends "res://scripts/ads/ads_default.gd" + +var rng = RandomNumberGenerator.new() +# Called when the node enters the scene tree for the first time. +func _ready(): + $Panel2/Button.disabled = false + var images = [ load("res://ressources/assets/NormalAds/PosterCrab2.png") + ,load("res://ressources/assets/NormalAds/PosterCrab.png") + ,load("res://ressources/assets/NormalAds/PosterMeow2.png") + ,load("res://ressources/assets/NormalAds/PosterMeow.png") + ] + var val = rng.randf_range(0, 4) + $Sprite2D.set_texture (images[val]) + + $Sprite2D.set_offset (Vector2($Sprite2D.texture.get_width()/2, ($Sprite2D.texture.get_height()/2)+30)) + pass + + +func _on_button_pressed(): + condition = true + print("pressed") diff --git a/scripts/ads/ads_default.gd b/scripts/ads/ads_default.gd index 11425ca..deca7ca 100644 --- a/scripts/ads/ads_default.gd +++ b/scripts/ads/ads_default.gd @@ -5,12 +5,13 @@ extends "res://scripts/ads.gd" 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): +func _process(delta): close() func _on_button_pressed():