commit 142bf87eca757be5976525d0f9118fa5124ec976 Author: Henry Date: Sat Mar 21 17:22:41 2026 +0000 Initial commit. diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f28239b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +root = true + +[*] +charset = utf-8 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0af181c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Godot 4+ specific ignores +.godot/ +/android/ diff --git a/graphics/ship.png b/graphics/ship.png new file mode 100644 index 0000000..f2c46a0 Binary files /dev/null and b/graphics/ship.png differ diff --git a/graphics/ship.png.import b/graphics/ship.png.import new file mode 100644 index 0000000..7953638 --- /dev/null +++ b/graphics/ship.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cq4we1m1yv22s" +path="res://.godot/imported/ship.png-e398fa390058251cc1af127a02bfbb4d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://graphics/ship.png" +dest_files=["res://.godot/imported/ship.png-e398fa390058251cc1af127a02bfbb4d.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/graphics/shot.png b/graphics/shot.png new file mode 100644 index 0000000..334bbb0 Binary files /dev/null and b/graphics/shot.png differ diff --git a/graphics/shot.png.import b/graphics/shot.png.import new file mode 100644 index 0000000..62485f6 --- /dev/null +++ b/graphics/shot.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ti1uy42vnnhw" +path="res://.godot/imported/shot.png-93dd8e23e063a652efaf74a48064083f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://graphics/shot.png" +dest_files=["res://.godot/imported/shot.png-93dd8e23e063a652efaf74a48064083f.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/icon.svg b/icon.svg new file mode 100644 index 0000000..c6bbb7d --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..e852093 --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cllikc7pyqgf0" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..b45b334 --- /dev/null +++ b/project.godot @@ -0,0 +1,61 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="Facsimile Wing" +config/features=PackedStringArray("4.6", "Forward Plus") +config/icon="res://icon.svg" + +[display] + +window/size/viewport_width=216 +window/size/viewport_height=384 +window/size/window_width_override=648 +window/size/window_height_override=1152 +window/stretch/mode="viewport" +window/stretch/aspect="keep_width" + +[input] + +right={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null) +] +} +left={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null) +] +} +up={ +"deadzone": 0.2, +"events": [null, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null) +] +} +down={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null) +] +} +shoot={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) +] +} + +[physics] + +3d/physics_engine="Jolt Physics" + +[rendering] + +textures/canvas_textures/default_texture_filter=0 +rendering_device/driver.windows="d3d12" diff --git a/resources/shot_stock.tres b/resources/shot_stock.tres new file mode 100644 index 0000000..a3817e7 --- /dev/null +++ b/resources/shot_stock.tres @@ -0,0 +1,11 @@ +[gd_resource type="Resource" script_class="PlayerShot" format=3 uid="uid://cels8t3hqjtsu"] + +[ext_resource type="Script" uid="uid://ccdohs4gduee5" path="res://scripts/player_shot.gd" id="1_dpne1"] +[ext_resource type="Texture2D" uid="uid://ti1uy42vnnhw" path="res://graphics/shot.png" id="2_fu23f"] + +[resource] +script = ExtResource("1_dpne1") +shot_name = "Stock" +speed = -300 +cooldown = 0.0 +metadata/_custom_type_script = "uid://ccdohs4gduee5" diff --git a/scenes/game.tscn b/scenes/game.tscn new file mode 100644 index 0000000..8adc7d2 --- /dev/null +++ b/scenes/game.tscn @@ -0,0 +1,7 @@ +[gd_scene format=3 uid="uid://dqd8cxe7aj3b4"] + +[ext_resource type="PackedScene" uid="uid://bj4fytc3sy482" path="res://scenes/world.tscn" id="1_uwrxv"] + +[node name="Game" type="Node2D" unique_id=1673976895] + +[node name="World" parent="." unique_id=1317852169 instance=ExtResource("1_uwrxv")] diff --git a/scenes/player.tscn b/scenes/player.tscn new file mode 100644 index 0000000..43f80a2 --- /dev/null +++ b/scenes/player.tscn @@ -0,0 +1,20 @@ +[gd_scene format=3 uid="uid://coix5dqblmu7r"] + +[ext_resource type="Script" uid="uid://otm88638j7f8" path="res://scripts/player.gd" id="1_g2els"] +[ext_resource type="Texture2D" uid="uid://cq4we1m1yv22s" path="res://graphics/ship.png" id="2_qhqgy"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_dqkch"] + +[node name="Player" type="Area2D" unique_id=652131079] +script = ExtResource("1_g2els") + +[node name="Ship" type="Sprite2D" parent="." unique_id=1155866924] +unique_name_in_owner = true +texture = ExtResource("2_qhqgy") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=485826453] +shape = SubResource("RectangleShape2D_dqkch") + +[node name="WeaponCooldown" type="Timer" parent="." unique_id=269678170] + +[connection signal="timeout" from="WeaponCooldown" to="." method="_on_weapon_cooldown_timeout"] diff --git a/scenes/stock_weapon.tscn b/scenes/stock_weapon.tscn new file mode 100644 index 0000000..98e8b10 --- /dev/null +++ b/scenes/stock_weapon.tscn @@ -0,0 +1,12 @@ +[gd_scene format=3 uid="uid://ddpclu2vdy2ve"] + +[ext_resource type="Script" uid="uid://d1rwqotmrag1r" path="res://scripts/stock_weapon.gd" id="1_hsma2"] +[ext_resource type="Resource" uid="uid://cels8t3hqjtsu" path="res://resources/shot_stock.tres" id="2_ckjv1"] +[ext_resource type="Texture2D" uid="uid://ti1uy42vnnhw" path="res://graphics/shot.png" id="3_mvdrj"] + +[node name="StockWeapon" type="Area2D" unique_id=1832200900] +script = ExtResource("1_hsma2") +shot_data = ExtResource("2_ckjv1") + +[node name="Sprite2D" type="Sprite2D" parent="." unique_id=2134507225] +texture = ExtResource("3_mvdrj") diff --git a/scenes/ui.tscn b/scenes/ui.tscn new file mode 100644 index 0000000..ed9cd79 --- /dev/null +++ b/scenes/ui.tscn @@ -0,0 +1,9 @@ +[gd_scene format=3 uid="uid://14fhj8834pkq"] + +[node name="UI" type="Control" unique_id=480295610] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 diff --git a/scenes/world.tscn b/scenes/world.tscn new file mode 100644 index 0000000..6cbd8e6 --- /dev/null +++ b/scenes/world.tscn @@ -0,0 +1,3 @@ +[gd_scene format=3 uid="uid://bj4fytc3sy482"] + +[node name="World" type="Node2D" unique_id=1317852169] diff --git a/scripts/event_bus.gd b/scripts/event_bus.gd new file mode 100644 index 0000000..c817135 --- /dev/null +++ b/scripts/event_bus.gd @@ -0,0 +1,6 @@ +extends Node + +@warning_ignore_start("unused_signal") # since otherwise Godot will throw a warning that the signal is unused in current scope + + +@warning_ignore_restore("unused_signal") # put any future signals you add between the two ignore annotations diff --git a/scripts/event_bus.gd.uid b/scripts/event_bus.gd.uid new file mode 100644 index 0000000..422b812 --- /dev/null +++ b/scripts/event_bus.gd.uid @@ -0,0 +1 @@ +uid://bv56i5pud2p3x diff --git a/scripts/player.gd b/scripts/player.gd new file mode 100644 index 0000000..78ae529 --- /dev/null +++ b/scripts/player.gd @@ -0,0 +1,72 @@ +extends Area2D + +@export var speed: int = 150 +@export var shield_max: int = 10 + +var shield: int = 0: set = shield_set +var can_shoot: bool = true +var is_shooting: bool = false + +var weapon_current = load("res://scenes/stock_weapon.tscn") +var weapon_cooldown = Timer +var weapon_rate: float = 0.1 +var weapon_timer: float = 0.0 + +@onready var screensize = get_viewport_rect().size + +func _process(delta): + var input = Input.get_vector("left", "right", "up","down") + + #TODO: sprite frame change on x axis + #if input.x > 0: + #$Ship.frame = 2 + #$Ship/Boosters.animation = "right" + #elif input.x < 0: + #$Ship.frame = 0 + #$Ship/Boosters.animation = "left" + #else: + #$Ship.frame = 1 + #$Ship/Boosters.animation = "forward" + + position += input * speed * delta + position = position.clamp(Vector2(12,12), screensize - Vector2(12,12)) + + if Input.is_action_pressed("shoot"): + print("Spacebar pressed!") + is_shooting = true + else: + is_shooting = false + + if is_shooting == true: + weapon_timer += delta + print(weapon_timer) + if weapon_timer >= weapon_rate: + shoot() + weapon_timer = 0.0 + + if is_shooting == false: return + +func shield_set(_sdvalue: int): + return + + +func _on_weapon_cooldown_timeout() -> void: + #print("You can shoot again!") + #can_shoot = true + return + + +func shoot(): + + #if not can_shoot: return + #if can_shoot: + var bullet = weapon_current.instantiate() + bullet.position = self.position + Vector2(0,-12) + get_tree().root.add_child(bullet) + weapon_rate = bullet.shot_data.rate + print(bullet.shot_data.shot_name, " weapon fired") #Print which weapon is firing + #weapon_cooldown = $WeaponCooldown + #weapon_cooldown.wait_time = bullet.shot_data.cooldown + #weapon_cooldown.start() + #can_shoot = not can_shoot + diff --git a/scripts/player.gd.uid b/scripts/player.gd.uid new file mode 100644 index 0000000..6f7dbe2 --- /dev/null +++ b/scripts/player.gd.uid @@ -0,0 +1 @@ +uid://otm88638j7f8 diff --git a/scripts/player_shot.gd b/scripts/player_shot.gd new file mode 100644 index 0000000..948979b --- /dev/null +++ b/scripts/player_shot.gd @@ -0,0 +1,9 @@ +class_name PlayerShot +extends Resource + +@export var shot_name: String +@export var damage: int = 1 +@export var speed: int = 100 +@export var rate: float = 0.1 +@export var cooldown: float = 0.25 +@export var sprite: Texture2D = preload("res://graphics/shot.png") diff --git a/scripts/player_shot.gd.uid b/scripts/player_shot.gd.uid new file mode 100644 index 0000000..7b3116e --- /dev/null +++ b/scripts/player_shot.gd.uid @@ -0,0 +1 @@ +uid://ccdohs4gduee5 diff --git a/scripts/stock_weapon.gd b/scripts/stock_weapon.gd new file mode 100644 index 0000000..7f3417f --- /dev/null +++ b/scripts/stock_weapon.gd @@ -0,0 +1,9 @@ +extends Area2D + +@onready var bullet = load("res://scenes/stock_weapon.tscn") + +@export var shot_data: PlayerShot + + +func _process(delta): + position.y += shot_data.speed * delta diff --git a/scripts/stock_weapon.gd.uid b/scripts/stock_weapon.gd.uid new file mode 100644 index 0000000..0c6432a --- /dev/null +++ b/scripts/stock_weapon.gd.uid @@ -0,0 +1 @@ +uid://d1rwqotmrag1r