Adds new animations and background

This commit is contained in:
txrpe 2024-10-06 22:14:51 +02:00
parent feda1c5077
commit 7288d0e658
17 changed files with 212 additions and 43 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 77 KiB

BIN
Assets/Buttons/IMG_3495.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

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

BIN
Assets/IMG_3402.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

View File

@ -2,16 +2,16 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://e40ep7k06vl7" uid="uid://byq6ebvgyc0s6"
path="res://.godot/imported/IMG_3395.png-444125b1e8a2dd612897e8bc6d2b3513.ctex" path="res://.godot/imported/IMG_3402.png-8d4e86453e6a811014de8a9352a4876f.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://Assets/Buttons/IMG_3395.png" source_file="res://Assets/IMG_3402.png"
dest_files=["res://.godot/imported/IMG_3395.png-444125b1e8a2dd612897e8bc6d2b3513.ctex"] dest_files=["res://.godot/imported/IMG_3402.png-8d4e86453e6a811014de8a9352a4876f.ctex"]
[params] [params]

BIN
Assets/Seven Segment.ttf Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://dr1wo1inm6yfw"
path="res://.godot/imported/Seven Segment.ttf-bb7c3ea895f9196b1b68b656d06b36c8.fontdata"
[deps]
source_file="res://Assets/Seven Segment.ttf"
dest_files=["res://.godot/imported/Seven Segment.ttf-bb7c3ea895f9196b1b68b656d06b36c8.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View File

@ -1,7 +1,6 @@
extends Node2D extends Node2D
@export var input_name = "" @export var input_name = ""
@export var color_mix:Color = Color(1,1,1)
const ENEMY = preload("res://Scenes/Worm/enemy.tscn") const ENEMY = preload("res://Scenes/Worm/enemy.tscn")
const DISTANCE = 40 const DISTANCE = 40
var red_button = false var red_button = false
@ -51,11 +50,7 @@ func red_out():
$AnimatedSprite2D.play("red_out") $AnimatedSprite2D.play("red_out")
func _process(delta: float) -> void: func _process(delta: float) -> void:
match $AnimatedSprite2D.animation: pass
"default", "pressed":
$AnimatedSprite2D.modulate = color_mix
_:
$AnimatedSprite2D.modulate = Color(1,1,1)
func spawn_enemy(): func spawn_enemy():
if(trans): if(trans):

View File

@ -3,7 +3,7 @@
[ext_resource type="Script" path="res://Scenes/Button/button.gd" id="1_fkyus"] [ext_resource type="Script" path="res://Scenes/Button/button.gd" id="1_fkyus"]
[ext_resource type="Texture2D" uid="uid://cmnangp78o1y6" path="res://Assets/Buttons/IMG_3394.png" id="2_jyhi7"] [ext_resource type="Texture2D" uid="uid://cmnangp78o1y6" path="res://Assets/Buttons/IMG_3394.png" id="2_jyhi7"]
[ext_resource type="Texture2D" uid="uid://8ce1ggql35ki" path="res://Assets/Buttons/IMG_3403.png" id="3_1lg6b"] [ext_resource type="Texture2D" uid="uid://8ce1ggql35ki" path="res://Assets/Buttons/IMG_3403.png" id="3_1lg6b"]
[ext_resource type="Texture2D" uid="uid://e40ep7k06vl7" path="res://Assets/Buttons/IMG_3395.png" id="4_ho636"] [ext_resource type="Texture2D" uid="uid://c4efcnd8qyo2p" path="res://Assets/Buttons/IMG_3495.png" id="4_dyrxo"]
[ext_resource type="Texture2D" uid="uid://cdilvc7bopjtg" path="res://Assets/Buttons/IMG_3393.png" id="5_wgvcg"] [ext_resource type="Texture2D" uid="uid://cdilvc7bopjtg" path="res://Assets/Buttons/IMG_3393.png" id="5_wgvcg"]
[ext_resource type="Texture2D" uid="uid://cqmf1i4v81bl6" path="res://Assets/Buttons/IMG_3402.png" id="6_lmv6p"] [ext_resource type="Texture2D" uid="uid://cqmf1i4v81bl6" path="res://Assets/Buttons/IMG_3402.png" id="6_lmv6p"]
[ext_resource type="Texture2D" uid="uid://iujiv0je2v1i" path="res://Assets/Explosion/IMG_3416.png" id="7_dr88a"] [ext_resource type="Texture2D" uid="uid://iujiv0je2v1i" path="res://Assets/Explosion/IMG_3416.png" id="7_dr88a"]
@ -34,7 +34,7 @@ animations = [{
"texture": ExtResource("3_1lg6b") "texture": ExtResource("3_1lg6b")
}, { }, {
"duration": 2.0, "duration": 2.0,
"texture": ExtResource("4_ho636") "texture": ExtResource("4_dyrxo")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("3_1lg6b") "texture": ExtResource("3_1lg6b")

BIN
Scenes/background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 MiB

View File

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

View File

@ -6,7 +6,7 @@ var dialog_step = 0
var is_dialog_active = false var is_dialog_active = false
signal dialogue_over signal dialogue_over
func start(): func start_dialog_1():
visible = true visible = true
is_dialog_active = true is_dialog_active = true
dialogue = load_dialogue() dialogue = load_dialogue()
@ -25,8 +25,7 @@ func _unhandled_input(event: InputEvent) -> void:
handle_dialog_change() handle_dialog_change()
func handle_dialog_change(): func handle_dialog_change():
$NinePatchRect/Name.text = dialogue[dialog_step].name $Text.text = dialogue[dialog_step].text
$NinePatchRect/Text.text = dialogue[dialog_step].text
func load_dialogue(): func load_dialogue():

View File

@ -22,7 +22,7 @@ func _unhandled_input(event: InputEvent) -> void:
func _ready() -> void: func _ready() -> void:
$Dialog.start() $Dialog.start_dialog_1()
func start_game(): func start_game():
game_active = true game_active = true

View File

@ -1,10 +1,12 @@
[gd_scene load_steps=10 format=3 uid="uid://decsef3jj3lt5"] [gd_scene load_steps=12 format=3 uid="uid://decsef3jj3lt5"]
[ext_resource type="Script" path="res://game.gd" id="1_bhcvq"] [ext_resource type="Script" path="res://game.gd" id="1_bhcvq"]
[ext_resource type="PackedScene" uid="uid://bhvihrt8dipll" path="res://Scenes/Button/button.tscn" id="1_j4pve"] [ext_resource type="PackedScene" uid="uid://bhvihrt8dipll" path="res://Scenes/Button/button.tscn" id="1_j4pve"]
[ext_resource type="Shader" path="res://game.gdshader" id="2_k6uao"] [ext_resource type="Shader" path="res://game.gdshader" id="2_k6uao"]
[ext_resource type="PackedScene" uid="uid://du2jgrreaylhr" path="res://Scenes/dialog.tscn" id="3_s0nfr"] [ext_resource type="Texture2D" uid="uid://b4d0kcmvv4qcx" path="res://Scenes/background.png" id="3_hovne"]
[ext_resource type="Script" path="res://camera_2d.gd" id="4_u8t00"] [ext_resource type="Script" path="res://camera_2d.gd" id="4_u8t00"]
[ext_resource type="Script" path="res://Scenes/dialog.gd" id="7_64bvv"]
[ext_resource type="FontFile" uid="uid://dr1wo1inm6yfw" path="res://Assets/Seven Segment.ttf" id="7_ydsit"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_sesmb"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_sesmb"]
size = Vector2(995, 433.534) size = Vector2(995, 433.534)
@ -26,8 +28,6 @@ shader_parameter/Noise = SubResource("NoiseTexture2D_0s1i7")
process_mode = 3 process_mode = 3
script = ExtResource("1_bhcvq") script = ExtResource("1_bhcvq")
[node name="Dialog" parent="." instance=ExtResource("3_s0nfr")]
[node name="CanvasLayer" type="CanvasLayer" parent="."] [node name="CanvasLayer" type="CanvasLayer" parent="."]
layer = -1 layer = -1
follow_viewport_enabled = true follow_viewport_enabled = true
@ -45,60 +45,62 @@ scale = Vector2(1.00712, 1.00483)
color = Color(0.623529, 0.14902, 0.184314, 0.592157) color = Color(0.623529, 0.14902, 0.184314, 0.592157)
[node name="Label" type="Label" parent="CanvasLayer"] [node name="Label" type="Label" parent="CanvasLayer"]
z_index = 10
anchors_preset = 5 anchors_preset = 5
anchor_left = 0.5 anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
offset_left = -86.0 offset_left = -133.0
offset_right = 86.0 offset_top = 510.0
offset_bottom = 99.0 offset_right = 39.0
offset_bottom = 609.0
grow_horizontal = 2 grow_horizontal = 2
scale = Vector2(1.44085, 0.87726)
size_flags_horizontal = 8 size_flags_horizontal = 8
theme_override_colors/font_color = Color(0, 0, 0, 1) theme_override_colors/font_color = Color(0, 1, 0, 1)
theme_override_font_sizes/font_size = 40 theme_override_fonts/font = ExtResource("7_ydsit")
theme_override_font_sizes/font_size = 65
text = "0" text = "0"
horizontal_alignment = 1 horizontal_alignment = 1
[node name="Dialog2" parent="CanvasLayer" instance=ExtResource("3_s0nfr")] [node name="TextureRect" type="TextureRect" parent="CanvasLayer"]
offset_left = -13.0
offset_top = -288.0
offset_right = 2987.0
offset_bottom = 2712.0
scale = Vector2(0.397971, 0.397971)
texture = ExtResource("3_hovne")
[node name="A" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")] [node name="A" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")]
position = Vector2(872, 515) position = Vector2(861, 566)
input_name = "A" input_name = "A"
color_mix = Color(1.01075e-06, 0.583986, 0.337423, 1)
[node name="DOWN" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")] [node name="DOWN" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")]
position = Vector2(236, 515) position = Vector2(222, 577)
input_name = "DOWN" input_name = "DOWN"
color_mix = Color(1.01075e-06, 0.583986, 0.337423, 1)
[node name="UP" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")] [node name="UP" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")]
position = Vector2(236, 330) position = Vector2(223, 381)
input_name = "UP" input_name = "UP"
color_mix = Color(1.01075e-06, 0.583986, 0.337423, 1)
[node name="RIGHT" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")] [node name="RIGHT" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")]
position = Vector2(334, 422) position = Vector2(350, 476)
input_name = "RIGHT" input_name = "RIGHT"
color_mix = Color(1.01075e-06, 0.583986, 0.337423, 1)
[node name="LEFT" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")] [node name="LEFT" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")]
position = Vector2(143, 422) position = Vector2(104, 471)
input_name = "LEFT" input_name = "LEFT"
color_mix = Color(1.01075e-06, 0.583986, 0.337423, 1)
[node name="Y" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")] [node name="Y" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")]
position = Vector2(872, 330) position = Vector2(861, 381)
input_name = "Y" input_name = "Y"
color_mix = Color(0.917, 1, 0.17, 1)
[node name="X" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")] [node name="X" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")]
position = Vector2(777, 422) position = Vector2(766, 473)
input_name = "X" input_name = "X"
color_mix = Color(0, 0.424825, 0.812361, 1)
[node name="B" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")] [node name="B" parent="." groups=["button_group"] instance=ExtResource("1_j4pve")]
position = Vector2(984, 425) position = Vector2(973, 476)
input_name = "B" input_name = "B"
color_mix = Color(0.74, 0, 0.0123331, 1)
[node name="SpawnArea" type="Area2D" parent="."] [node name="SpawnArea" type="Area2D" parent="."]
visible = false visible = false
@ -125,5 +127,21 @@ material = SubResource("ShaderMaterial_ob5l5")
offset_right = 1177.0 offset_right = 1177.0
offset_bottom = 668.0 offset_bottom = 668.0
[connection signal="dialogue_over" from="Dialog" to="." method="_on_dialog_dialogue_over"] [node name="Dialog" type="CanvasLayer" parent="."]
script = ExtResource("7_64bvv")
d_file = "res://Assets/dialogs.json"
[node name="Text" type="RichTextLabel" parent="Dialog"]
offset_left = 362.0
offset_top = 103.0
offset_right = 1089.0
offset_bottom = 269.0
scale = Vector2(0.624223, 0.607973)
theme_override_colors/default_color = Color(0.299668, 0.801919, 0.469303, 1)
theme_override_fonts/normal_font = ExtResource("7_ydsit")
theme_override_font_sizes/normal_font_size = 81
text = "Text"
custom_effects = [null]
[connection signal="timeout" from="SpawnTimer" to="." method="_on_spawn_timer_timeout"] [connection signal="timeout" from="SpawnTimer" to="." method="_on_spawn_timer_timeout"]
[connection signal="dialogue_over" from="Dialog" to="." method="_on_dialog_dialogue_over"]

55
perspective.gdshader Normal file
View File

@ -0,0 +1,55 @@
// Hey this is Hei! This shader "fakes" a 3D-camera perspective on CanvasItems.
// License: MIT
shader_type canvas_item;
// Camera FOV
uniform float fov : hint_range(1, 179) = 90;
uniform bool cull_back = true;
uniform float y_rot : hint_range(-180, 180) = 0.0;
uniform float x_rot : hint_range(-180, 180) = 0.0;
// At 0, the image retains its size when unrotated.
// At 1, the image is resized so that it can do a full
// rotation without clipping inside its rect.
uniform float inset : hint_range(0, 1) = 0.0;
// Consider changing this to a uniform and changing it from code
varying flat vec2 o;
varying vec3 p;
// Creates rotation matrix
void vertex(){
float sin_b = sin(y_rot / 180.0 * PI);
float cos_b = cos(y_rot / 180.0 * PI);
float sin_c = sin(x_rot / 180.0 * PI);
float cos_c = cos(x_rot / 180.0 * PI);
mat3 inv_rot_mat;
inv_rot_mat[0][0] = cos_b;
inv_rot_mat[0][1] = 0.0;
inv_rot_mat[0][2] = -sin_b;
inv_rot_mat[1][0] = sin_b * sin_c;
inv_rot_mat[1][1] = cos_c;
inv_rot_mat[1][2] = cos_b * sin_c;
inv_rot_mat[2][0] = sin_b * cos_c;
inv_rot_mat[2][1] = -sin_c;
inv_rot_mat[2][2] = cos_b * cos_c;
float t = tan(fov / 360.0 * PI);
p = inv_rot_mat * vec3((UV - 0.5), 0.5 / t);
float v = (0.5 / t) + 0.5;
p.xy *= v * inv_rot_mat[2].z;
o = v * inv_rot_mat[2].xy;
VERTEX += (UV - 0.5) / TEXTURE_PIXEL_SIZE * t * (1.0 - inset);
}
void fragment(){
if (cull_back && p.z <= 0.0) discard;
vec2 uv = (p.xy / p.z).xy - o;
COLOR = texture(TEXTURE, uv + 0.5);
COLOR.a *= step(max(abs(uv.x), abs(uv.y)), 0.5);
}