Started a Godot Project to remake Tailgunner.

This commit is contained in:
KingGurke 2025-04-02 12:36:05 +02:00
commit 9621323983
67 changed files with 976 additions and 0 deletions

4
.editorconfig Normal file
View file

@ -0,0 +1,4 @@
root = true
[*]
charset = utf-8

2
.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
# Godot 4+ specific ignores
.godot/
/android/

BIN
audio/ammo-short.wav Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bh2f28tf7g0cp"
path="res://.godot/imported/ammo-short.wav-9334bf6338f1001a40c1ee06376a1da8.sample"
[deps]
source_file="res://audio/ammo-short.wav"
dest_files=["res://.godot/imported/ammo-short.wav-9334bf6338f1001a40c1ee06376a1da8.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/gamemusic.wav Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://d103vlsb010bp"
path="res://.godot/imported/gamemusic.wav-65b544ad25fd28e049d05412cf8da6f5.sample"
[deps]
source_file="res://audio/gamemusic.wav"
dest_files=["res://.godot/imported/gamemusic.wav-65b544ad25fd28e049d05412cf8da6f5.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/gun1.wav Normal file

Binary file not shown.

24
audio/gun1.wav.import Normal file
View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bkguu5u88kjlk"
path="res://.godot/imported/gun1.wav-6a6a21857fec5dae3aec1d0321aea848.sample"
[deps]
source_file="res://audio/gun1.wav"
dest_files=["res://.godot/imported/gun1.wav-6a6a21857fec5dae3aec1d0321aea848.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/gun2.wav Normal file

Binary file not shown.

24
audio/gun2.wav.import Normal file
View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cbpofkydw3sa5"
path="res://.godot/imported/gun2.wav-4714773c2fc792c6eb783a79ee76d110.sample"
[deps]
source_file="res://audio/gun2.wav"
dest_files=["res://.godot/imported/gun2.wav-4714773c2fc792c6eb783a79ee76d110.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/gun3.wav Normal file

Binary file not shown.

24
audio/gun3.wav.import Normal file
View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://clg0ybr0jlcwc"
path="res://.godot/imported/gun3.wav-cc75b94728ca18a91be32ee9ec76b432.sample"
[deps]
source_file="res://audio/gun3.wav"
dest_files=["res://.godot/imported/gun3.wav-cc75b94728ca18a91be32ee9ec76b432.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/gun4.wav Normal file

Binary file not shown.

24
audio/gun4.wav.import Normal file
View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://brc0i5e6x7v4h"
path="res://.godot/imported/gun4.wav-f7b412df8810f1c6123168da7ec801c8.sample"
[deps]
source_file="res://audio/gun4.wav"
dest_files=["res://.godot/imported/gun4.wav-f7b412df8810f1c6123168da7ec801c8.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/hitmarker1.wav Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cvs2wrg3owksy"
path="res://.godot/imported/hitmarker1.wav-e385a11113bebe74a403b0246be0b2d9.sample"
[deps]
source_file="res://audio/hitmarker1.wav"
dest_files=["res://.godot/imported/hitmarker1.wav-e385a11113bebe74a403b0246be0b2d9.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/hitmarker2.wav Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cohcjp6hedtrc"
path="res://.godot/imported/hitmarker2.wav-5028e98689dd5cb586e137ee5be00fe2.sample"
[deps]
source_file="res://audio/hitmarker2.wav"
dest_files=["res://.godot/imported/hitmarker2.wav-5028e98689dd5cb586e137ee5be00fe2.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/menumusic.wav Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cuph5d8ybwlx6"
path="res://.godot/imported/menumusic.wav-1757225a112917a10b52386ec138bdc9.sample"
[deps]
source_file="res://audio/menumusic.wav"
dest_files=["res://.godot/imported/menumusic.wav-1757225a112917a10b52386ec138bdc9.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/plane-explodes1.wav Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dymdl83a3ygsw"
path="res://.godot/imported/plane-explodes1.wav-606cf9a6563533cebceed23237602a03.sample"
[deps]
source_file="res://audio/plane-explodes1.wav"
dest_files=["res://.godot/imported/plane-explodes1.wav-606cf9a6563533cebceed23237602a03.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/plane-explodes2.wav Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://clxuyw25dlu8o"
path="res://.godot/imported/plane-explodes2.wav-ed4361b33fd9ac998124d83b266a9b9b.sample"
[deps]
source_file="res://audio/plane-explodes2.wav"
dest_files=["res://.godot/imported/plane-explodes2.wav-ed4361b33fd9ac998124d83b266a9b9b.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/plane.wav Normal file

Binary file not shown.

24
audio/plane.wav.import Normal file
View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cx6mysnvtjf3j"
path="res://.godot/imported/plane.wav-af532827831b13128cc15f2dc0adac41.sample"
[deps]
source_file="res://audio/plane.wav"
dest_files=["res://.godot/imported/plane.wav-af532827831b13128cc15f2dc0adac41.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/ram1.wav Normal file

Binary file not shown.

24
audio/ram1.wav.import Normal file
View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dsw41d6q80ocg"
path="res://.godot/imported/ram1.wav-fbc15fadb64c72f559798095bd7ac9d8.sample"
[deps]
source_file="res://audio/ram1.wav"
dest_files=["res://.godot/imported/ram1.wav-fbc15fadb64c72f559798095bd7ac9d8.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/ram2.wav Normal file

Binary file not shown.

24
audio/ram2.wav.import Normal file
View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://b7aggndu81cas"
path="res://.godot/imported/ram2.wav-fc23381f6b8166d4d1a05d20331b86ab.sample"
[deps]
source_file="res://audio/ram2.wav"
dest_files=["res://.godot/imported/ram2.wav-fc23381f6b8166d4d1a05d20331b86ab.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/ram3.wav Normal file

Binary file not shown.

24
audio/ram3.wav.import Normal file
View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bxe6yaqhrh7i8"
path="res://.godot/imported/ram3.wav-79229930e00688f5a74f65f9f3683ec9.sample"
[deps]
source_file="res://audio/ram3.wav"
dest_files=["res://.godot/imported/ram3.wav-79229930e00688f5a74f65f9f3683ec9.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/reload.wav Normal file

Binary file not shown.

24
audio/reload.wav.import Normal file
View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://1ca3gx11lgsq"
path="res://.godot/imported/reload.wav-b1e40daab9856df17357bd50e3676732.sample"
[deps]
source_file="res://audio/reload.wav"
dest_files=["res://.godot/imported/reload.wav-b1e40daab9856df17357bd50e3676732.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/rocket-explosion.wav Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dp8ahg1cqqef2"
path="res://.godot/imported/rocket-explosion.wav-f939bfedba3043bd777d5845887ed63c.sample"
[deps]
source_file="res://audio/rocket-explosion.wav"
dest_files=["res://.godot/imported/rocket-explosion.wav-f939bfedba3043bd777d5845887ed63c.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
audio/rocket.wav Normal file

Binary file not shown.

24
audio/rocket.wav.import Normal file
View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dnwyp27xuhyyo"
path="res://.godot/imported/rocket.wav-4fa88100f276abff4f9b4f53140a6357.sample"
[deps]
source_file="res://audio/rocket.wav"
dest_files=["res://.godot/imported/rocket.wav-4fa88100f276abff4f9b4f53140a6357.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

1
icon.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>

After

Width:  |  Height:  |  Size: 994 B

37
icon.svg.import Normal file
View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://sy7egm43byme"
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/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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

58
project.godot Normal file
View file

@ -0,0 +1,58 @@
; 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="Tailgunner"
run/main_scene="uid://c0688rpnga7bt"
config/features=PackedStringArray("4.4", "GL Compatibility")
config/icon="res://icon.svg"
[input]
plane_up={
"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":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
]
}
plane_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)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
]
}
plane_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)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":-1.0,"script":null)
]
}
plane_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)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null)
]
}
shoot_primary={
"deadzone": 0.2,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(151, 20),"global_position":Vector2(160, 68),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}
shoot_secondary={
"deadzone": 0.2,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(52, 20),"global_position":Vector2(61, 68),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"

31
scenes/flyer.tscn Normal file
View file

@ -0,0 +1,31 @@
[gd_scene load_steps=6 format=3 uid="uid://c0688rpnga7bt"]
[ext_resource type="Script" uid="uid://b5qkxnurvqbi2" path="res://scripts/flyer.gd" id="1_ben2c"]
[ext_resource type="Texture2D" uid="uid://djduujf1cj53r" path="res://sprites/pilotnorkt.png" id="2_ddpln"]
[ext_resource type="Script" uid="uid://cu7q3fqvjoyos" path="res://scripts/player_controller.gd" id="3_ddpln"]
[ext_resource type="Script" uid="uid://cr8aonshxxpqf" path="res://scripts/weapon.gd" id="4_isfd2"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_isfd2"]
size = Vector2(74.5, 29)
[node name="Node2D" type="Node2D"]
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
script = ExtResource("1_ben2c")
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
position = Vector2(3.75, 1.5)
shape = SubResource("RectangleShape2D_isfd2")
[node name="Sprite2D" type="Sprite2D" parent="CharacterBody2D"]
texture_filter = 1
texture = ExtResource("2_ddpln")
[node name="PlayerController" type="Node" parent="CharacterBody2D" node_paths=PackedStringArray("controlled_flyer")]
script = ExtResource("3_ddpln")
controlled_flyer = NodePath("..")
metadata/_custom_type_script = "uid://cu7q3fqvjoyos"
[node name="Weapon" type="Node2D" parent="CharacterBody2D"]
script = ExtResource("4_isfd2")
metadata/_custom_type_script = "uid://cr8aonshxxpqf"

72
scripts/flyer.gd Normal file
View file

@ -0,0 +1,72 @@
class_name Flyer
extends CharacterBody2D
# constants
## Maximum angle in degrees that the flyer can tilt.
@export var max_tilt = 45
## Maximum acceleration of the flyer in vertical directions. Measured in pixels per second.
@export var vertical_accelleration = 5
## Maximum acceleration of the flyer in horizontal directions. Measured in pixels per second.
@export var horizontal_accelleration = 15
## Default deceleration of the flyer in vertical directions when no input is given. Measured in pixels per second.
@export var vertical_decelleration = 8
## Default deceleration of the flyer in horizontal directions when no input is given. Measured in pixels per second.
@export var horizontal_decelleration = 20
## Maximum speed of the flyer in vertical directions. Measured in pixels per second.
@export var vertical_max_speed = 300
## Maximum speed of the flyer in horizontal directions. Measured in pixels per second.
@export var horizontal_max_speed = 300
@export var max_hp = 100
@export var weapons: Array[Weapon]
@export var friendly = false
#@export var panAudio = true
# gameplay variables
var tilt
var speed
var hp
var directionInput
func _ready() -> void:
hp = max_hp
max_tilt = deg_to_rad(max_tilt)
directionInput = Vector2(0,0)
func _physics_process(delta: float) -> void:
# convert control input to movement
var verticalIn = directionInput.y
var horizontalIn = directionInput.x
if verticalIn:
if (verticalIn / velocity.y) < 0:
velocity.y = move_toward(velocity.y, vertical_max_speed, verticalIn * (vertical_decelleration))
else:
velocity.y = move_toward(velocity.y, sign(verticalIn) * vertical_max_speed, sign(verticalIn) * verticalIn * vertical_accelleration)
else:
velocity.y = move_toward(velocity.y, 0, vertical_decelleration)
if horizontalIn:
if (horizontalIn / velocity.x) < 0:
velocity.x = move_toward(velocity.x, horizontal_max_speed, horizontalIn * (horizontal_decelleration))
else:
velocity.x = move_toward(velocity.x, sign(horizontalIn) * horizontal_max_speed, sign(horizontalIn) * horizontalIn * horizontal_accelleration)
else:
velocity.x = move_toward(velocity.x, 0, horizontal_decelleration)
#print_debug("current velocity: ", velocity, ", current input: ", Vector2(horizontalIn, verticalIn), ", input signs: ", Vector2(sign(horizontalIn), sign(verticalIn)))
move_and_collide(velocity * delta)
# tilt the flyer according to vertical movement.
tilt = velocity.y / vertical_max_speed * max_tilt
rotation = tilt
func shoot(index):
if weapons.size() > index:
weapons[index].shoot()
func deal_damage(amount):
hp -= amount
if hp <= 0:
die()
func die():
return
#TODO: implement death

1
scripts/flyer.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://b5qkxnurvqbi2

View file

@ -0,0 +1,23 @@
@tool
class_name FlyerController
extends Node
# references
@export var controlled_flyer: Flyer:
set(new_flyer):
controlled_flyer = new_flyer
update_configuration_warnings()
func _ready() -> void:
if Engine.is_editor_hint():
var parent = get_parent()
if (parent is Flyer):
controlled_flyer = parent
update_configuration_warnings()
func _get_configuration_warnings():
var warnings = []
if controlled_flyer == null:
warnings.append("Please select a flyer to be controlled by this controller.")
return warnings

View file

@ -0,0 +1 @@
uid://b71mg3snmjp88

View file

@ -0,0 +1,11 @@
@tool
class_name PlayerController
extends FlyerController
func _physics_process(delta: float) -> void:
if not Engine.is_editor_hint():
controlled_flyer.directionInput = Vector2(Input.get_axis("plane_left","plane_right"), Input.get_axis("plane_up","plane_down"))
if InputMap.has_action("shoot_primary") and Input.is_action_just_pressed("shoot_primary"):
controlled_flyer.shoot(1)
if InputMap.has_action("shoot_secondary") and Input.is_action_just_pressed("shoot_secondary"):
controlled_flyer.shoot(2)

View file

@ -0,0 +1 @@
uid://cu7q3fqvjoyos

18
scripts/projectile.gd Normal file
View file

@ -0,0 +1,18 @@
class_name Projectile
extends CharacterBody2D
# constants
@export var speed = 10
@export var damage = 5
@export var friendly = false
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
func _physics_process(delta: float) -> void:
var target = move_and_collide(velocity * delta).get_collider()
if target is Flyer && friendly != target.friendly:
target.deal_damage(damage)
queue_free()

View file

@ -0,0 +1 @@
uid://8y2wqva60nom

41
scripts/weapon.gd Normal file
View file

@ -0,0 +1,41 @@
class_name Weapon
extends Node2D
# constants
@export var max_ammo = 1
## Number of seconds until the weapon can be used again.
@export var cooldown = 1
@export var shot: Projectile
@export var shot_spawn: Node2D
@export var audio: AudioStreamRandomizer
# gameplay variables
var ammo
var timer = 0.0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
ammo = max_ammo
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
timer += delta
# Creates and returns an instance of the weapon's projectile.
func shoot() -> Projectile:
if timer > cooldown && ammo > 0:
timer = 0
var new_shot = shot.instantiate()
owner.add_child(new_shot)
new_shot.transform = shot_spawn.transform
ammo -= 1
audio.play()
return new_shot
else:
return null
func add_ammo(amount):
ammo += amount
if ammo > max_ammo:
ammo = max_ammo

1
scripts/weapon.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://cr8aonshxxpqf

BIN
sprites/Bcloud1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b8do4vo88ksra"
path="res://.godot/imported/Bcloud1.png-cca9fd43544703e1cc2ffec9072a5f53.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/Bcloud1.png"
dest_files=["res://.godot/imported/Bcloud1.png-cca9fd43544703e1cc2ffec9072a5f53.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
sprites/Bcloud2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b3qrkdfjb4uw5"
path="res://.godot/imported/Bcloud2.png-9b084b758e85ebc89aee0bf140296c24.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/Bcloud2.png"
dest_files=["res://.godot/imported/Bcloud2.png-9b084b758e85ebc89aee0bf140296c24.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
sprites/cloud1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

34
sprites/cloud1.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c6ckrd0wrpd55"
path="res://.godot/imported/cloud1.png-e61c0635f3e75e7413c5630489eaab16.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/cloud1.png"
dest_files=["res://.godot/imported/cloud1.png-e61c0635f3e75e7413c5630489eaab16.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
sprites/cloud2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

34
sprites/cloud2.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://5nx8lmjif82p"
path="res://.godot/imported/cloud2.png-9fbf80d7f64e876ae1c3711039bb61a0.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/cloud2.png"
dest_files=["res://.godot/imported/cloud2.png-9fbf80d7f64e876ae1c3711039bb61a0.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
sprites/cloud3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

34
sprites/cloud3.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://3t8eupq5u8cd"
path="res://.godot/imported/cloud3.png-23a3f92fcb471f05f7fc04bb837b3a56.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/cloud3.png"
dest_files=["res://.godot/imported/cloud3.png-23a3f92fcb471f05f7fc04bb837b3a56.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
sprites/cloud4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 KiB

34
sprites/cloud4.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b615po65xtqrn"
path="res://.godot/imported/cloud4.png-1a910f00b0b9823dbe73ad592ae46a43.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/cloud4.png"
dest_files=["res://.godot/imported/cloud4.png-1a910f00b0b9823dbe73ad592ae46a43.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
sprites/pilotnorkt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

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