diff --git a/model/Boss1Phase1.png.import b/model/Boss1Phase1.png.import new file mode 100644 index 0000000..4de6caf --- /dev/null +++ b/model/Boss1Phase1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bf4apksygpavq" +path="res://.godot/imported/Boss1Phase1.png-683d6007cf3146ab744c8816c2dd3ad9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/Boss1Phase1.png" +dest_files=["res://.godot/imported/Boss1Phase1.png-683d6007cf3146ab744c8816c2dd3ad9.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/model/Boss1Phase2.png.import b/model/Boss1Phase2.png.import new file mode 100644 index 0000000..af48696 --- /dev/null +++ b/model/Boss1Phase2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ddtdf5ipblr61" +path="res://.godot/imported/Boss1Phase2.png-c96fbc8bbb5eb81b6be8f58d08474886.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/Boss1Phase2.png" +dest_files=["res://.godot/imported/Boss1Phase2.png-c96fbc8bbb5eb81b6be8f58d08474886.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/model/Boss2Phase1.png.import b/model/Boss2Phase1.png.import new file mode 100644 index 0000000..2c2bb11 --- /dev/null +++ b/model/Boss2Phase1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://jckl6jmf3f5k" +path="res://.godot/imported/Boss2Phase1.png-a6be9275a4dc1fd1bff3a65bbd6eff3d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/Boss2Phase1.png" +dest_files=["res://.godot/imported/Boss2Phase1.png-a6be9275a4dc1fd1bff3a65bbd6eff3d.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/model/Boss2Phase2.png.import b/model/Boss2Phase2.png.import new file mode 100644 index 0000000..40f9db5 --- /dev/null +++ b/model/Boss2Phase2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b0qlf56ngggfx" +path="res://.godot/imported/Boss2Phase2.png-08e6eddcb02310a190aa72efa761c5a9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/Boss2Phase2.png" +dest_files=["res://.godot/imported/Boss2Phase2.png-08e6eddcb02310a190aa72efa761c5a9.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/model/Boss3Phase1.png.import b/model/Boss3Phase1.png.import new file mode 100644 index 0000000..d2e0591 --- /dev/null +++ b/model/Boss3Phase1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cb8hbsxgq1mp5" +path="res://.godot/imported/Boss3Phase1.png-6a3983d35df9dc07efa6f54658065ee6.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/Boss3Phase1.png" +dest_files=["res://.godot/imported/Boss3Phase1.png-6a3983d35df9dc07efa6f54658065ee6.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/model/Boss3Phase2.png.import b/model/Boss3Phase2.png.import new file mode 100644 index 0000000..61a43e4 --- /dev/null +++ b/model/Boss3Phase2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b3jjeuoythcys" +path="res://.godot/imported/Boss3Phase2.png-06c7c4a077b1751648aa3dd7b27c8d2e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/Boss3Phase2.png" +dest_files=["res://.godot/imported/Boss3Phase2.png-06c7c4a077b1751648aa3dd7b27c8d2e.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/model/PatrickGameConsole1.png.import b/model/PatrickGameConsole1.png.import new file mode 100644 index 0000000..61e85a0 --- /dev/null +++ b/model/PatrickGameConsole1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d0tifgesw6o2c" +path="res://.godot/imported/PatrickGameConsole1.png-12749cfaa64fd214b1c71f14f3a5a38e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/PatrickGameConsole1.png" +dest_files=["res://.godot/imported/PatrickGameConsole1.png-12749cfaa64fd214b1c71f14f3a5a38e.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/model/PatrickGameConsole2.png.import b/model/PatrickGameConsole2.png.import new file mode 100644 index 0000000..a9b831c --- /dev/null +++ b/model/PatrickGameConsole2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ufsduorrajdw" +path="res://.godot/imported/PatrickGameConsole2.png-34d0d30223046c74542c2993506294c0.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/PatrickGameConsole2.png" +dest_files=["res://.godot/imported/PatrickGameConsole2.png-34d0d30223046c74542c2993506294c0.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/model/TextBubbleGC.png.import b/model/TextBubbleGC.png.import new file mode 100644 index 0000000..28a5c22 --- /dev/null +++ b/model/TextBubbleGC.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://if5c87wwqbkg" +path="res://.godot/imported/TextBubbleGC.png-a370b449a03a32d93b341c099c255f38.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://model/TextBubbleGC.png" +dest_files=["res://.godot/imported/TextBubbleGC.png-a370b449a03a32d93b341c099c255f38.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/scene/city.tscn b/scene/city.tscn index a6d82ba..d8884ce 100644 --- a/scene/city.tscn +++ b/scene/city.tscn @@ -1962,7 +1962,7 @@ scale = Vector2(-1, 1) texture = ExtResource("16_ssypi") [node name="CharacterBody2D" parent="." instance=ExtResource("2_nmm2d")] -position = Vector2(1368, 1595) +position = Vector2(1914, 1595) [editable path="Flash/Path2D/PathFollow2D2/Car"] [editable path="Flash/Path2D/PathFollow2D3/Car"] diff --git a/scene/control/menu.tscn b/scene/control/menu.tscn index 01962b6..ae60a93 100644 --- a/scene/control/menu.tscn +++ b/scene/control/menu.tscn @@ -83,6 +83,7 @@ text = "Exit " [node name="trick" type="Panel" parent="."] +visible = false layout_mode = 1 pivot_offset = Vector2(-200, -150) theme_override_styles/panel = SubResource("StyleBoxEmpty_q8v2y") diff --git a/scene/gameboy.tscn b/scene/gameboy.tscn index cfda746..1803579 100644 --- a/scene/gameboy.tscn +++ b/scene/gameboy.tscn @@ -1,15 +1,202 @@ -[gd_scene load_steps=6 format=3 uid="uid://bj1ita42m6vj5"] +[gd_scene load_steps=17 format=3 uid="uid://bj1ita42m6vj5"] [ext_resource type="Texture2D" uid="uid://blkdbhu6usvic" path="res://model/GameConsole.png" id="1_1xnas"] [ext_resource type="Script" path="res://script/Gameboy.cs" id="1_8q5hj"] [ext_resource type="Texture2D" uid="uid://uudw2vydoal1" path="res://model/GCMenu.png" id="2_06g1x"] +[ext_resource type="Texture2D" uid="uid://bf4apksygpavq" path="res://model/Boss1Phase1.png" id="4_4qacm"] [ext_resource type="Theme" uid="uid://547aer6bl6w8" path="res://themes/theme_buttons_gameboy.tres" id="4_a5nt6"] +[ext_resource type="Texture2D" uid="uid://ddtdf5ipblr61" path="res://model/Boss1Phase2.png" id="6_45a70"] +[ext_resource type="Theme" uid="uid://d0wymiuig18m3" path="res://themes/label.tres" id="6_pwgdt"] +[ext_resource type="Texture2D" uid="uid://jckl6jmf3f5k" path="res://model/Boss2Phase1.png" id="7_qjgmv"] +[ext_resource type="Texture2D" uid="uid://b0qlf56ngggfx" path="res://model/Boss2Phase2.png" id="8_n7m7p"] +[ext_resource type="Texture2D" uid="uid://cb8hbsxgq1mp5" path="res://model/Boss3Phase1.png" id="9_15ltb"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fjb7e"] bg_color = Color(0.0862745, 0.0862745, 0.0862745, 0.596078) -[node name="CanvasLayer" type="CanvasLayer"] +[sub_resource type="Animation" id="Animation_pwrbo"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Panel/CenterContainer/GcMenu:texture") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [ExtResource("2_06g1x")] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Panel/CenterContainer/boss:texture") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [ExtResource("4_4qacm")] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Label:text") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": ["wedwedwdwdwde"] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Label:visible") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("Panel/CenterContainer/GcMenu:visible") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [true] +} +tracks/5/type = "value" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("Panel/CenterContainer/boss:visible") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { +"times": PackedFloat32Array(0.001), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} + +[sub_resource type="Animation" id="Animation_4imyd"] +resource_name = "start" +length = 0.2 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Panel/CenterContainer/boss:texture") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [ExtResource("4_4qacm")] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Label:text") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0.0333334), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": ["Black spell of destruction"] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Label:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0.2), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [true] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Panel/CenterContainer/GcMenu:visible") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0, 0.2, 0.2001), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 1, +"values": [true, false, false] +} +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("Panel/CenterContainer/boss:visible") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0.2), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [true] +} + +[sub_resource type="Animation" id="Animation_r3lxe"] +resource_name = "1" +length = 0.5 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Panel/CenterContainer/boss:texture") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.5), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1), +"update": 1, +"values": [ExtResource("6_45a70"), ExtResource("4_4qacm"), ExtResource("6_45a70"), ExtResource("4_4qacm"), ExtResource("6_45a70"), ExtResource("7_qjgmv")] +} + +[sub_resource type="Animation" id="Animation_fg42v"] +resource_name = "2" +length = 0.5 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Panel/CenterContainer/boss:texture") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.5), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1), +"update": 1, +"values": [ExtResource("8_n7m7p"), ExtResource("6_45a70"), ExtResource("8_n7m7p"), ExtResource("6_45a70"), ExtResource("8_n7m7p"), ExtResource("9_15ltb")] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_tpw5q"] +_data = { +"1": SubResource("Animation_r3lxe"), +"2": SubResource("Animation_fg42v"), +"RESET": SubResource("Animation_pwrbo"), +"start": SubResource("Animation_4imyd") +} + +[node name="gameboy" type="CanvasLayer" node_paths=PackedStringArray("anim", "scoreLabel")] script = ExtResource("1_8q5hj") +anim = NodePath("AnimationPlayer") +scoreLabel = NodePath("score") [node name="Panel" type="Panel" parent="."] anchors_preset = 15 @@ -35,6 +222,10 @@ texture = ExtResource("1_1xnas") [node name="GcMenu" type="Sprite2D" parent="Panel/CenterContainer"] texture = ExtResource("2_06g1x") +[node name="boss" type="Sprite2D" parent="Panel/CenterContainer"] +visible = false +texture = ExtResource("4_4qacm") + [node name="A" type="Button" parent="."] offset_left = 125.0 offset_top = 186.0 @@ -51,6 +242,32 @@ offset_bottom = 239.0 theme = ExtResource("4_a5nt6") text = " " -[node name="ScrollContainer" type="ScrollContainer" parent="."] -offset_right = 40.0 -offset_bottom = 40.0 +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +"": SubResource("AnimationLibrary_tpw5q") +} + +[node name="Label" type="Label" parent="."] +visible = false +offset_left = 124.0 +offset_top = 143.0 +offset_right = 279.0 +offset_bottom = 166.0 +theme = ExtResource("6_pwgdt") +theme_override_colors/font_color = Color(1, 1, 1, 1) +theme_override_font_sizes/font_size = 14 +text = "wedwedwdwdwde" +vertical_alignment = 2 +autowrap_mode = 3 + +[node name="score" type="Label" parent="."] +offset_left = 112.0 +offset_top = 44.0 +offset_right = 152.0 +offset_bottom = 67.0 +theme = ExtResource("6_pwgdt") +theme_override_font_sizes/font_size = 16 +text = "High Score : 0" + +[connection signal="pressed" from="A" to="." method="APressed"] +[connection signal="pressed" from="B" to="." method="BPressed"] diff --git a/scene/player.tscn b/scene/player.tscn index 8a86158..8c8d9b4 100644 --- a/scene/player.tscn +++ b/scene/player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=48 format=3 uid="uid://4ubk6w44h4s2"] +[gd_scene load_steps=49 format=3 uid="uid://4ubk6w44h4s2"] [ext_resource type="Script" path="res://script/Player.cs" id="1_gmlsd"] [ext_resource type="Texture2D" uid="uid://bo4q2rvn056p3" path="res://model/PatrickIdle1.png" id="2_w2lj6"] @@ -33,6 +33,7 @@ [ext_resource type="AudioStream" uid="uid://cpekdylimwdq7" path="res://sound/GameOver6.wav" id="13_0akal"] [ext_resource type="Texture2D" uid="uid://rbp38pbtd8e0" path="res://model/PatrickIdle2.png" id="13_2yj6y"] [ext_resource type="Theme" uid="uid://d0wymiuig18m3" path="res://themes/label.tres" id="15_hsss5"] +[ext_resource type="PackedScene" uid="uid://bj1ita42m6vj5" path="res://scene/gameboy.tscn" id="25_25150"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_qxy68"] height = 40.4 @@ -496,6 +497,11 @@ libraries = { autoplay = "glitch" speed_scale = 1.5 +[node name="CanvasLayer2" parent="Camera2D" node_paths=PackedStringArray("player", "Cmenu") instance=ExtResource("25_25150")] +visible = false +player = NodePath("../..") +Cmenu = NodePath("../menu") + [node name="anim" type="AnimationPlayer" parent="."] process_mode = 3 libraries = { diff --git a/script/Gameboy.cs b/script/Gameboy.cs index af80177..d88574b 100644 --- a/script/Gameboy.cs +++ b/script/Gameboy.cs @@ -1,30 +1,103 @@ using Godot; +using Godot.Collections; using System; public partial class Gameboy : CanvasLayer { [Export] CharacterBody2D player; + + //[Export] Array image_boss; + [Export] AnimationPlayer anim; + [Export] Control Cmenu; + [Export] Label scoreLabel; + + bool menu = true; + int round = -1; + int actScore = 0; + + int score = 0; // Called when the node enters the scene tree for the first time. public override void _Ready() { + Visible = false; + anim.Play("RESET"); } // Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(double delta) - { - + { + if (Input.IsActionJustPressed("game")) + { + start(); + } + else if (Input.IsActionJustPressed("interact") || Input.IsActionJustPressed("game")) + { + stop(); + } } void start() { - player.Set("pausable", false); + Input.MouseMode = Input.MouseModeEnum.Visible; + player.Set("pausable", false); this.Visible = true; } void stop() { + Input.MouseMode = Input.MouseModeEnum.Hidden; player.Set("pausable", true); this.Visible = false; } + + void attack() + { + if((int)Cmenu.Get("spell") -1 >= round) + { + round = (round + 1) % 8; + anim.Play(round.ToString()); + actScore++; + updateScore(); + } + else + { + actScore = 0; + anim.Play("RESET"); + menu = true; + } + } + + public void APressed() + { + if (menu) + { + menu = false; + round = 0; + anim.Play("start"); + } + else + { + attack(); + } + } + + public void BPressed() + { + if (menu) + { + stop(); + } + else + { + menu = true; + anim.Play("RESET"); + } + } + + void updateScore() + { + if (actScore >= score) score = actScore; + scoreLabel.Text = "High Score : " + score.ToString(); + } } diff --git a/script/Menu.cs b/script/Menu.cs index 2055cc9..aaca5af 100644 --- a/script/Menu.cs +++ b/script/Menu.cs @@ -9,7 +9,7 @@ public partial class Menu : Control [Export] Panel trick; [Export] CharacterBody2D player; Node parent; - int spell {get; set;} = 0; + int spell {get; set;} = 2; // Called when the node enters the scene tree for the first time. public override void _Ready()