Anri/AdBlockNot
Archived
1
0
Fork 0

Mode infini et normal implémenté + écran de fin (victoire & défaite)

This commit is contained in:
2-1-1-2 2024-01-28 21:53:02 +01:00
parent 8b08e93f49
commit c7d6a5c17a
11 changed files with 387 additions and 17 deletions

View file

@ -17,6 +17,10 @@ run/main_scene="res://scenes/World.tscn"
config/features=PackedStringArray("4.2", "Forward Plus")
config/icon="res://icon.svg"
[autoload]
Global="*res://scripts/Global.gd"
[display]
window/size/viewport_width=1600

16
scenes/game/ButtonMenu.gd Normal file
View file

@ -0,0 +1,16 @@
extends Button
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_pressed():
get_tree().change_scene_to_file("res://scenes/menu/menu.tscn")

BIN
scenes/game/bluescreen.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bua0evfrn3dx3"
path="res://.godot/imported/bluescreen.png-eb81efc8e5b3b0a20f96d6fde7bcb1d3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scenes/game/bluescreen.png"
dest_files=["res://.godot/imported/bluescreen.png-eb81efc8e5b3b0a20f96d6fde7bcb1d3.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

125
scenes/game/defeat.tscn Normal file
View file

@ -0,0 +1,125 @@
[gd_scene load_steps=15 format=3 uid="uid://b5ahyt8lpc5bw"]
[ext_resource type="Texture2D" uid="uid://dksppcu3bp4l3" path="res://scenes/game/wallpaper.png" id="1_yrh27"]
[ext_resource type="Texture2D" uid="uid://bua0evfrn3dx3" path="res://scenes/game/bluescreen.png" id="2_4mh72"]
[ext_resource type="Shader" path="res://shaders/oldscreen.gdshader" id="2_osgq8"]
[ext_resource type="AudioStream" uid="uid://cjnulxaww6ej5" path="res://ressources/sounds/AdBlockNot.wav" id="4_1e4eg"]
[ext_resource type="FontFile" uid="uid://dwgslonlru0ck" path="res://ressources/Battlenet.ttf" id="5_qb7xa"]
[ext_resource type="Texture2D" uid="uid://c012k8qiyjn4a" path="res://models/RetroWindowsGUI/RetroWindowsGUI/Windows_Button.png" id="6_0sgxu"]
[ext_resource type="Texture2D" uid="uid://ca0n6csxw7yd7" path="res://models/RetroWindowsGUI/RetroWindowsGUI/Windows_Button_Pressed.png" id="7_3gdk0"]
[ext_resource type="Texture2D" uid="uid://c1s8gaui8k13h" path="res://models/RetroWindowsGUI/Flag.png" id="8_kut6k"]
[ext_resource type="Script" path="res://scenes/game/ButtonMenu.gd" id="9_mdvc8"]
[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="ShaderMaterial" id="ShaderMaterial_lp2yn"]
shader = ExtResource("2_osgq8")
shader_parameter/SCREEN_HEIGHT = 240.0
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_mbq4w"]
texture = ExtResource("6_0sgxu")
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("7_3gdk0")
texture_margin_left = 2.0
texture_margin_top = 2.0
texture_margin_right = 2.0
texture_margin_bottom = 2.0
draw_center = false
[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
[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="Wallpaper" type="Sprite2D" parent="ColorRect"]
position = Vector2(803, 422)
scale = Vector2(1.77778, 1.66798)
texture = ExtResource("1_yrh27")
[node name="Bluescreen" type="Sprite2D" parent="ColorRect"]
position = Vector2(799.25, 449.75)
scale = Vector2(2.26803, 2.27099)
texture = ExtResource("2_4mh72")
[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="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
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource("4_1e4eg")
volume_db = -14.102
autoplay = true
bus = &"Music"
[node name="Button" type="Button" parent="."]
layout_mode = 0
offset_left = 4.0
offset_top = 850.0
offset_right = 312.0
offset_bottom = 896.0
focus_mode = 0
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_fonts/font = ExtResource("5_qb7xa")
theme_override_font_sizes/font_size = 37
theme_override_styles/normal = SubResource("StyleBoxTexture_mbq4w")
theme_override_styles/hover = SubResource("StyleBoxTexture_lgpbg")
text = "Retourner au menu"
icon = ExtResource("8_kut6k")
expand_icon = true
script = ExtResource("9_mdvc8")
[connection signal="pressed" from="Button" to="Button" method="_on_pressed"]

View file

@ -128,3 +128,16 @@ stream = ExtResource("9_j4hp8")
volume_db = -14.102
autoplay = true
bus = &"Music"
[node name="Timer" type="Timer" parent="."]
process_callback = 0
[node name="Label" type="Label" parent="."]
layout_mode = 0
offset_left = 36.0
offset_right = 246.0
offset_bottom = 64.0
theme_override_fonts/font = ExtResource("1_7ecbr")
theme_override_font_sizes/font_size = 46
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]

View file

@ -1,3 +0,0 @@
[gd_scene format=3 uid="uid://b6d3echpt32xs"]
[node name="Victoire" type="Node2D"]

136
scenes/game/victory.tscn Normal file
View file

@ -0,0 +1,136 @@
[gd_scene load_steps=15 format=3 uid="uid://d0qssindm5rlw"]
[ext_resource type="Texture2D" uid="uid://dksppcu3bp4l3" path="res://scenes/game/wallpaper.png" id="2_vyyfh"]
[ext_resource type="FontFile" uid="uid://dwgslonlru0ck" path="res://ressources/Battlenet.ttf" id="3_vkkp2"]
[ext_resource type="Texture2D" uid="uid://c012k8qiyjn4a" path="res://models/RetroWindowsGUI/RetroWindowsGUI/Windows_Button.png" id="4_pyb8u"]
[ext_resource type="Texture2D" uid="uid://ca0n6csxw7yd7" path="res://models/RetroWindowsGUI/RetroWindowsGUI/Windows_Button_Pressed.png" id="5_5cogn"]
[ext_resource type="Script" path="res://scenes/game/ButtonMenu.gd" id="6_as1pi"]
[ext_resource type="Texture2D" uid="uid://c1s8gaui8k13h" path="res://models/RetroWindowsGUI/Flag.png" id="6_le0fq"]
[ext_resource type="Shader" path="res://shaders/oldscreen.gdshader" id="7_omj8e"]
[ext_resource type="PackedScene" uid="uid://b4ujwtugvmurm" path="res://scenes/game/windows/Video_page.tscn" id="8_rworg"]
[ext_resource type="AudioStream" uid="uid://cjnulxaww6ej5" path="res://ressources/sounds/AdBlockNot.wav" id="10_mppi6"]
[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="ShaderMaterial" id="ShaderMaterial_lp2yn"]
shader = ExtResource("7_omj8e")
shader_parameter/SCREEN_HEIGHT = 240.0
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_mbq4w"]
texture = ExtResource("4_pyb8u")
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("5_5cogn")
texture_margin_left = 2.0
texture_margin_top = 2.0
texture_margin_right = 2.0
texture_margin_bottom = 2.0
draw_center = false
[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
[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="Wallpaper" type="Sprite2D" parent="ColorRect"]
position = Vector2(803, 422)
scale = Vector2(1.77778, 1.66798)
texture = ExtResource("2_vyyfh")
[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="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
[node name="VideoPage" parent="." instance=ExtResource("8_rworg")]
layout_mode = 1
offset_left = 96.0
offset_top = 89.0
offset_right = -459.0
offset_bottom = -265.0
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource("10_mppi6")
volume_db = -14.102
autoplay = true
bus = &"Music"
[node name="Label" type="Label" parent="."]
offset_left = 522.0
offset_top = 710.0
offset_right = 1029.0
offset_bottom = 847.0
theme_override_fonts/font = ExtResource("3_vkkp2")
theme_override_font_sizes/font_size = 156
text = "VICTOIRE"
[node name="Button" type="Button" parent="."]
layout_mode = 0
offset_left = 4.0
offset_top = 850.0
offset_right = 312.0
offset_bottom = 896.0
focus_mode = 0
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_fonts/font = ExtResource("3_vkkp2")
theme_override_font_sizes/font_size = 37
theme_override_styles/normal = SubResource("StyleBoxTexture_mbq4w")
theme_override_styles/hover = SubResource("StyleBoxTexture_lgpbg")
text = "Retourner au menu"
icon = ExtResource("6_le0fq")
expand_icon = true
script = ExtResource("6_as1pi")
[connection signal="pressed" from="Button" to="Button" method="_on_pressed"]

View file

@ -1,6 +1,5 @@
extends Node2D
# Called when the node enters the scene tree for the first time.
func _ready():
$Menu/Options/Rules.set_visible(false)
@ -16,10 +15,12 @@ func _on_power_off_pressed():
get_tree().change_scene_to_file("res://scenes/menu/leaving_scene.tscn")
func _on_normal_start_pressed():
#get_tree().change_scene_to_file("")
Global.mode = 1
get_tree().change_scene_to_file("res://scenes/game/screen.tscn")
pass # Replace with function body.
func _on_infinite_start_pressed():
Global.mode = 2
get_tree().change_scene_to_file("res://scenes/game/screen.tscn")
func _on_options_pressed():

2
scripts/Global.gd Normal file
View file

@ -0,0 +1,2 @@
extends Node
var mode = 1;

View file

@ -1,6 +1,9 @@
extends Control
var ads_scene = []
var ads = []
var level = [10, 15, 25]
var nlevel = 0
var nb = 10
"""
var ads_scene = [preload("res://scenes/game/ads/Ads_password.tscn"),
preload("res://scenes/game/ads/Ads_sudoku.tscn")]
@ -33,6 +36,7 @@ func new_ads():
print("her")
randomize()
var _range = randi_range(0, ads_scene.size()-1)
print(_range)
var instance = ads_scene[_range].instantiate()
add_child(instance) # Replace with function body.
var _scale = Vector2(0.5,0.5)
@ -46,13 +50,8 @@ func new_ads():
# Called when the node enters the scene tree for the first time.
func load_scene():
for scene in [ "res://scenes/game/ads/ads_music.tscn"
, "res://scenes/game/ads/ads_normal.tscn"
, "res://scenes/game/ads/ads_operation.tscn"
, "res://scenes/game/ads/ads_pair.tscn"
, "res://scenes/game/ads/ads_roll.tscn"
, "res://scenes/game/ads/ads_sexy_robot.tscn"
, "res://scenes/game/ads/ads_weather.tscn" ]:
var _ads_scene = getFilePathsByExtension("res://scenes/game/ads", "tscn")
for scene in _ads_scene:
ads_scene.push_back(load(scene))
func _input(event):
@ -60,20 +59,60 @@ func _input(event):
pass # todo one day ahah ^^
# $Rules.set_visible(true)
func newLevel():
for n in nb:
new_ads()
Reset_Timer()
$Timer.start()
func _ready():
load_scene()
print(ads_scene)
for n in 15:
new_ads()
if Global.mode == 1 :
nb = level[nlevel]
if Global.mode == 2 :
pass
newLevel()
var seconds=0
var Dsecond=45
func win():
for ad in ads:
if ad.visible == true :
return false
if Global.mode == 1 :
nlevel +=1
if nlevel < 3:
nb = level[nlevel]
newLevel()
return false
return true
# Called every frame. 'delta' is the elapsed time since the previous frame.
func lose():
return seconds == 0
func _process(_delta):
if lose():
$Timer.stop()
get_tree().change_scene_to_file("res://scenes/game/defeat.tscn")
if win():
for n in 15:
new_ads()
# get_tree().change_scene_to_file("res://scenes/game/victoire.tscn")
if Global.mode == 1 :
$Timer.stop()
get_tree().change_scene_to_file("res://scenes/game/victory.tscn")
if Global.mode == 2 :
nb +=5
newLevel()
func _on_timer_timeout():
$Label.text = str(seconds)
seconds -=1
func Reset_Timer():
seconds=Dsecond