diff --git a/apps/gamejam/brackeys/13/assets/frostwindz/battlecruiser_exhaust.png b/apps/gamejam/brackeys/13/assets/frostwindz/battlecruiser_exhaust.png new file mode 100644 index 000000000..e123b8010 Binary files /dev/null and b/apps/gamejam/brackeys/13/assets/frostwindz/battlecruiser_exhaust.png differ diff --git a/apps/gamejam/brackeys/13/assets/frostwindz/battlecruiser_exhaust.png.import b/apps/gamejam/brackeys/13/assets/frostwindz/battlecruiser_exhaust.png.import new file mode 100644 index 000000000..0e8f9ade9 --- /dev/null +++ b/apps/gamejam/brackeys/13/assets/frostwindz/battlecruiser_exhaust.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://buvmwoh578i7v" +path="res://.godot/imported/battlecruiser_exhaust.png-912cadbd57de55ee3ed43f6cbbf4e83c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/frostwindz/battlecruiser_exhaust.png" +dest_files=["res://.godot/imported/battlecruiser_exhaust.png-912cadbd57de55ee3ed43f6cbbf4e83c.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/apps/gamejam/brackeys/13/scenes/game.tscn b/apps/gamejam/brackeys/13/scenes/game.tscn index 990865be6..64ddb1e85 100644 --- a/apps/gamejam/brackeys/13/scenes/game.tscn +++ b/apps/gamejam/brackeys/13/scenes/game.tscn @@ -71,6 +71,9 @@ layout_mode = 2 [node name="Label" type="Label" parent="CanvasLayer/UI/HUD/Panel/Menu/Nav"] layout_mode = 2 +[node name="StarshipHeat" type="Label" parent="CanvasLayer/UI/HUD/Panel/Menu/Nav"] +layout_mode = 2 + [node name="HSplitContainer" type="HSplitContainer" parent="CanvasLayer/UI/HUD/Panel/Menu"] layout_mode = 2 split_offset = 10 diff --git a/apps/gamejam/brackeys/13/scenes/spaceship.tscn b/apps/gamejam/brackeys/13/scenes/spaceship.tscn index 21d83ff97..17157b2ab 100644 --- a/apps/gamejam/brackeys/13/scenes/spaceship.tscn +++ b/apps/gamejam/brackeys/13/scenes/spaceship.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=36 format=3 uid="uid://1s5v0llrjq3"] +[gd_scene load_steps=97 format=3 uid="uid://1s5v0llrjq3"] [ext_resource type="Script" path="res://scripts/spaceship.gd" id="1_uejed"] [ext_resource type="Texture2D" uid="uid://b5a5g0gqvormg" path="res://assets/frostwindz/battlecruiser.png" id="2_kvtre"] [ext_resource type="Texture2D" uid="uid://cj16mbdine6mk" path="res://assets/frostwindz/battlecruiser_engine.png" id="3_mwphh"] +[ext_resource type="Texture2D" uid="uid://buvmwoh578i7v" path="res://assets/frostwindz/battlecruiser_exhaust.png" id="4_e0b8n"] [ext_resource type="Texture2D" uid="uid://84n6013yietv" path="res://assets/frostwindz/battlecruiser_shield.png" id="4_yxx3w"] [sub_resource type="CircleShape2D" id="CircleShape2D_s734v"] @@ -100,6 +101,126 @@ animations = [{ "speed": 5.0 }] +[sub_resource type="AtlasTexture" id="AtlasTexture_f32dw"] +atlas = ExtResource("4_e0b8n") +region = Rect2(0, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_drtwp"] +atlas = ExtResource("4_e0b8n") +region = Rect2(128, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_11n8e"] +atlas = ExtResource("4_e0b8n") +region = Rect2(256, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_33tmt"] +atlas = ExtResource("4_e0b8n") +region = Rect2(384, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3c10b"] +atlas = ExtResource("4_e0b8n") +region = Rect2(512, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_03oc6"] +atlas = ExtResource("4_e0b8n") +region = Rect2(640, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_qycyb"] +atlas = ExtResource("4_e0b8n") +region = Rect2(768, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_2j20y"] +atlas = ExtResource("4_e0b8n") +region = Rect2(896, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_6er2f"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1024, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_lrbnf"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1152, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_mk2ku"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1280, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8clph"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1408, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_jguhh"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1536, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_2eblt"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1664, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_5ljpj"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1792, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_sinc8"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1920, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_in3rs"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2048, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_5warc"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2176, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_d3nke"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2304, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_iga1v"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2432, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ax0db"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2560, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_owh65"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2688, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8njy1"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2816, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_klpgg"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2944, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_iq0e6"] +atlas = ExtResource("4_e0b8n") +region = Rect2(3072, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8mpjt"] +atlas = ExtResource("4_e0b8n") +region = Rect2(3200, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4wuqy"] +atlas = ExtResource("4_e0b8n") +region = Rect2(3328, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_u5pjl"] +atlas = ExtResource("4_e0b8n") +region = Rect2(3456, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_lvinn"] +atlas = ExtResource("4_e0b8n") +region = Rect2(3584, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_i6iig"] +atlas = ExtResource("4_e0b8n") +region = Rect2(3712, 0, 128, 128) + [sub_resource type="AtlasTexture" id="AtlasTexture_srl8d"] atlas = ExtResource("4_yxx3w") region = Rect2(0, 0, 128, 128) @@ -164,8 +285,228 @@ region = Rect2(1792, 0, 128, 128) atlas = ExtResource("4_yxx3w") region = Rect2(1920, 0, 128, 128) +[sub_resource type="AtlasTexture" id="AtlasTexture_cviwk"] +atlas = ExtResource("4_e0b8n") +region = Rect2(640, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_5mw6y"] +atlas = ExtResource("4_e0b8n") +region = Rect2(512, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_6djsu"] +atlas = ExtResource("4_e0b8n") +region = Rect2(0, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_oqk2u"] +atlas = ExtResource("4_e0b8n") +region = Rect2(128, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gfm7b"] +atlas = ExtResource("4_e0b8n") +region = Rect2(256, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_vrkc0"] +atlas = ExtResource("4_e0b8n") +region = Rect2(384, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_oa07c"] +atlas = ExtResource("4_e0b8n") +region = Rect2(768, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ssyf7"] +atlas = ExtResource("4_e0b8n") +region = Rect2(896, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_03kwu"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1024, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_23q5p"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1152, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_c87ie"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1280, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_e5gjs"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1408, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ivnxd"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1536, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_0ippd"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1664, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_w1fox"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1792, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_fblp2"] +atlas = ExtResource("4_e0b8n") +region = Rect2(1920, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_qmrr8"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2048, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_nxfyt"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2176, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_1k1xr"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2304, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_hqla1"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2432, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_xk5sp"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2560, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_0s88r"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2688, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_y464m"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2816, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_1umyp"] +atlas = ExtResource("4_e0b8n") +region = Rect2(2944, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_xntc1"] +atlas = ExtResource("4_e0b8n") +region = Rect2(3072, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4b4sa"] +atlas = ExtResource("4_e0b8n") +region = Rect2(3200, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_0ffhj"] +atlas = ExtResource("4_e0b8n") +region = Rect2(3328, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ywsdr"] +atlas = ExtResource("4_e0b8n") +region = Rect2(3456, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_6tfdc"] +atlas = ExtResource("4_e0b8n") +region = Rect2(3584, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_cnq7o"] +atlas = ExtResource("4_e0b8n") +region = Rect2(3712, 0, 128, 128) + [sub_resource type="SpriteFrames" id="SpriteFrames_wdipm"] animations = [{ +"frames": [], +"loop": true, +"name": &"default", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_f32dw") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_drtwp") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_11n8e") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_33tmt") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_3c10b") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_03oc6") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_qycyb") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_2j20y") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_6er2f") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_lrbnf") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_mk2ku") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_8clph") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_jguhh") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_2eblt") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_5ljpj") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_sinc8") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_in3rs") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_5warc") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_d3nke") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_iga1v") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ax0db") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_owh65") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_8njy1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_klpgg") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_iq0e6") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_8mpjt") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4wuqy") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_u5pjl") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_lvinn") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_i6iig") +}], +"loop": false, +"name": &"exhaust", +"speed": 5.0 +}, { "frames": [{ "duration": 1.0, "texture": SubResource("AtlasTexture_srl8d") @@ -218,6 +559,101 @@ animations = [{ "loop": true, "name": &"shield", "speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_cviwk") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_5mw6y") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_6djsu") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_oqk2u") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_gfm7b") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_vrkc0") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_oa07c") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ssyf7") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_03kwu") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_23q5p") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_c87ie") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_e5gjs") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ivnxd") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_0ippd") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_w1fox") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_fblp2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_qmrr8") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_nxfyt") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_1k1xr") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_hqla1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_xk5sp") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_0s88r") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_y464m") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_1umyp") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_xntc1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4b4sa") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_0ffhj") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ywsdr") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_6tfdc") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_cnq7o") +}], +"loop": false, +"name": &"short_exhaust", +"speed": 15.0 }] [node name="Spaceship" type="CharacterBody2D"] @@ -247,7 +683,7 @@ animation = &"engine" position = Vector2(-8.34465e-07, 1.75) scale = Vector2(0.84375, 0.832031) sprite_frames = SubResource("SpriteFrames_wdipm") -animation = &"shield" +animation = &"short_exhaust" [node name="Camera2D" type="Camera2D" parent="."] position_smoothing_enabled = true diff --git a/apps/gamejam/brackeys/13/scripts/global.gd b/apps/gamejam/brackeys/13/scripts/global.gd index 411488753..f6b09d816 100644 --- a/apps/gamejam/brackeys/13/scripts/global.gd +++ b/apps/gamejam/brackeys/13/scripts/global.gd @@ -49,7 +49,8 @@ var starship_data := { "name": "Explorer-X", "emergency_rockets_used": false, "shield_active": false, - "coordinates": Vector2.ZERO + "coordinates": Vector2.ZERO, + "heat": 0.0 } func earn_random_resource(resource_name: String, min_value: int = 3, max_value: int = 15): @@ -111,12 +112,15 @@ func set_base_starship_stat(stat_name: String, new_value: float): emit_signal("starship_stat_changed", stat_name, get_starship_stat(stat_name)) func get_starship_data(data_name: String): - return starship_data.get(data_name, null) - + if not starship_data.has(data_name): + return null + return starship_data[data_name] + func set_starship_data(data_name: String, new_value): + print("set_starship_data called from:", get_stack()[1].source, "-> Setting", data_name, "to", new_value) starship_data[data_name] = new_value emit_signal("starship_data_changed", data_name, new_value) - + func get_environment_data(data_name: String): return environment_data.get(data_name, null) diff --git a/apps/gamejam/brackeys/13/scripts/hud.gd b/apps/gamejam/brackeys/13/scripts/hud.gd index 1995e8eab..66ee0a193 100644 --- a/apps/gamejam/brackeys/13/scripts/hud.gd +++ b/apps/gamejam/brackeys/13/scripts/hud.gd @@ -2,6 +2,7 @@ extends Control @onready var coordinates_label = $Panel/Menu/Nav/Label @onready var name_label = $Panel/Menu/Nav/StarshipName +@onready var heat_label = $Panel/Menu/Nav/StarshipHeat # Resources @@ -41,6 +42,11 @@ func _ready(): Global.connect("starship_data_changed", Callable(self, "_update_starship_data")) update_coordinates(Global.get_starship_coordinates()) + +func update_heat(heat: int): + if heat_label: + heat_label.text = "%d C" % [heat] + func update_coordinates(coords: Vector2): if coordinates_label: coordinates_label.text = "Coords X: %d, Y: %d" % [coords.x, coords.y] @@ -50,6 +56,8 @@ func update_coordinates(coords: Vector2): func _update_starship_data(data_name: String, value): if data_name == "coordinates": update_coordinates(value) + if data_name == "heat": + update_heat(value) # func _update_starship_resources(): # for resource in Global.resources_list: diff --git a/apps/gamejam/brackeys/13/scripts/projectiles.gd b/apps/gamejam/brackeys/13/scripts/projectiles.gd index bc1b31a52..7e45cde89 100644 --- a/apps/gamejam/brackeys/13/scripts/projectiles.gd +++ b/apps/gamejam/brackeys/13/scripts/projectiles.gd @@ -21,6 +21,8 @@ func shoot_laser(global_position: Vector2, rotation: float): active_lasers.append(laser) else: Global.emit_signal("notification_received","laser_low", "Laser Overheating", "error") + Global.set_starship_data("heat", (Global.get_starship_data("heat") as int) + 1) + #print("Out of laser energy shots") func _on_laser_exited(laser): diff --git a/apps/gamejam/brackeys/13/scripts/spaceship.gd b/apps/gamejam/brackeys/13/scripts/spaceship.gd index acf8f8b8e..9d8f779aa 100644 --- a/apps/gamejam/brackeys/13/scripts/spaceship.gd +++ b/apps/gamejam/brackeys/13/scripts/spaceship.gd @@ -7,23 +7,47 @@ signal laser_shot(laser) @onready var engine = $Engine @onready var shield = $Shield +# Heat +var last_heat_increase_time = 0.0 +var heat_increase_interval = 30.0 + var laser_scene = preload("res://scenes/laser.tscn") func _ready(): position = get_viewport_rect().size / 2 + shield.animation_finished.connect(_engine_cleanup) + engine.animation_finished.connect(_engine_buildup) + func _process(delta): - call_deferred("defer_set_starship_coordinates") if Input.is_action_pressed("shoot"): shield.visible = false shoot_laser() + call_deferred("defer_set_starship_coordinates") + func _physics_process(delta): var acceleration = Global.get_starship_stat("acceleration") var max_speed = Global.get_starship_stat("max_speed") var rotation_speed = Global.get_starship_stat("rotation_speed") var input_vector := Vector2(0, Input.get_axis("thrust", "reverse")) + var heat = Global.get_starship_data("heat") as int + + if heat == null: + heat = 0 + + if input_vector.y != 0 and Time.get_ticks_msec() / 1000.0 - last_heat_increase_time >= heat_increase_interval: + last_heat_increase_time = Time.get_ticks_msec() / 1000.0 + Global.set_starship_data("heat", heat + 1) + print("Heat increased:", heat + 1) + + if heat >= 100: + Global.emit_signal("notification_received", "heat_error", "Ship is Overheating!", "error") + input_vector = Vector2.ZERO + exhaust() + + velocity += input_vector.rotated(rotation) * acceleration velocity = velocity.limit_length(max_speed) @@ -43,11 +67,13 @@ func _physics_process(delta): if Input.is_action_pressed("drift_right"): #print("E Pressed - Thrust Right Detected") global_position = global_position.lerp(global_position + drift_direction * drift_force, delta * 5) + short_exhaust() if Input.is_action_pressed("drift_left"): #print("Q Pressed - Thrust Left Detected") global_position = global_position.lerp(global_position - drift_direction * drift_force, delta * 5) + short_exhaust() if input_vector.y == 0: velocity = velocity.move_toward(Vector2.ZERO, 3) @@ -68,9 +94,27 @@ func _physics_process(delta): func shoot_laser(): emit_signal("laser_shot", scope.global_position, rotation) +func _engine_cleanup(): + if shield.animation == "exhaust": + Global.emit_signal("notification_received", "engine_cleanup", "Engine bay is now cold.", "success") + Global.set_starship_data("heat", 1) + if shield.animation == "short_exhaust": + Global.emit_signal("notification_received", "engine_short", "Short Exhaust Engaged", "success") + Global.set_starship_data("heat", ((Global.get_starship_data("heat") as int) / 2) as int) + +func _engine_buildup(): + if engine.animation == "engine": + Global.set_starship_data("heat", (Global.get_starship_data("heat") as int) + 1) + +func exhaust(): + shield.play("exhaust") + +func short_exhaust(): + shield.play("short_exhaust") func activate_shield(): Global.emit_signal("notification_received", "shield_active", "Shield was deployed", "warning") + Global.set_starship_data("heat", (Global.get_starship_data("heat") as int) + 1) shield.visible = true shield.play("shield")