added Graphics and sound Effects and more overhauls

This commit is contained in:
Exobyt 2025-08-03 20:56:32 +02:00
parent c887a2168c
commit b9d4288900
214 changed files with 3378 additions and 198 deletions

View file

@ -0,0 +1,8 @@
extends Control
func _ready() -> void:
progressBarHealth.max_value = Globals.getPlayer().maxHealthh
func _physics_process(delta: float) -> void:

View file

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

View file

@ -0,0 +1,22 @@
extends Camera2D
var shake_duration: float = 0.5
var shake_magnitude: float = 10.0
var shake_timer: float = 0.0
var original_position: Vector2
func _ready():
original_position = position
func _process(delta: float) -> void:
if shake_timer > 0:
shake_timer -= delta
var offset = Vector2(randf_range(-shake_magnitude, shake_magnitude), randf_range(-shake_magnitude, shake_magnitude))
position = original_position + offset
else:
position = original_position
func shake(duration: float, magnitude: float) -> void:
shake_duration = duration
shake_magnitude = magnitude
shake_timer = shake_duration

View file

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

View file

@ -0,0 +1,10 @@
extends Control
@onready var moveButton = $MoveButton
@onready var shootButton = $ShootButton
@onready var shootButtonCorner = $ShootButtonCorner
@onready var moveButtonCorner = $MoveButtonCorner
func _physics_process(delta: float) -> void:
shootButton.global_position = shootButtonCorner.global_position
moveButton.global_position = moveButtonCorner.global_position

View file

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

View file

@ -1,42 +1,178 @@
class_name Player extends "res://scenes/spaceShip/spaceShip.gd"
@onready var dashCooldown = $dashCooldown
@onready var spawnPointPool = $spawnPointPool
@onready var timeGhostScene = preload("res://scenes/spaceShip/timeGhost/timeghost.tscn")
@onready var dashCooldown = $dashCooldown
@onready var selfHealTimer = $selfHealTimer
@onready var selfHealCountdownTimer = $selfHealCountdownTimer
@onready var progressBarHealth = $Camera2D/CanvasLayer/Control/VBoxContainer/HealthUi/ProgressBarHealth
@onready var progressBarSpeed = $Camera2D/CanvasLayer/Control/VBoxContainer/SpeedUi/ProgressBarSpeed
@onready var progressBarDashCooldown = $Camera2D/CanvasLayer/Control/VBoxContainer/DashCooldownUi/ProgressBarDashCooldown
@onready var progressBarWeaponCooldown = $Camera2D/CanvasLayer/Control/VBoxContainer/WeaponCooldown/ProgressBarWeaponCooldown
@onready var labelWaveInfo = $Camera2D/CanvasLayer/Control/HBoxContainer/HBoxContainer/LabelWaveInfo
@onready var labelWaveEnemiesInfo = $Camera2D/CanvasLayer/Control/HBoxContainer/HBoxContainer2/LabelWaveEnemiesInfo
@onready var labelWaveDestroyedInfo = $Camera2D/CanvasLayer/Control/HBoxContainer/HBoxContainer3/LabelWaveDestroyedInfo
@onready var upgradeChooser = $Camera2D/CanvasLayer/Control/UpgradeChooser
@onready var hit = $hit
@onready var input = $Camera2D/CanvasLayer/Control/Input
@export var spawnDistance: int = 5000
var maxSpeedMult: float = 3
var maxAcceleration: float = 1
var speedMult: float = 1
var damageMult: float = 1
var dashUnlocked: bool = false
var strifeUnlocked: bool = false
var selfHealUnlocked: bool = false
@export var spawnDistance: int = 1000
func _ready() -> void:
if Globals.touchscreen:
input.show()
progressBarHealth.max_value = maxHealth
progressBarSpeed.max_value = speed / 2
progressBarDashCooldown.max_value = dashCooldown.wait_time
randomize()
func _init() -> void:
pass
changeWeapon(SHOTGUN)
progressBarWeaponCooldown.max_value = weapon.cooldown
shortInvincibility()
await get_tree().create_timer(Globals.currentDelay).timeout
addGhost()
newUpgrade()
Globals.waveComplete.connect(newUpgrade)
func _physics_process(delta: float) -> void:
#if Input.is_action_pressed("attack"):
#attack()
#
#look_at(get_global_mouse_position())
#rotation += PI / 2
#var direction = Vector2.UP.normalized().rotated(rotation) * Input.get_action_strength("moveForward")
##Input.get_vector("moveForward", "moveBackward").normalized().rotated(rotation)
#if Input.is_action_just_pressed("dash") and dashCooldown.is_stopped():
#dash()
#velocity = velocity.lerp(direction * speed, acceleration * delta)
#move_and_slide()
#if timeGhost != null:
#moveTimeGhost(global_position, rotation)
if Input.is_action_pressed("attack"):
attack()
look_at(get_global_mouse_position())
var controllerDirection = Input.get_vector("lookLeft", "lookRight", "lookForward", "lookDown")
controllerDirection
if controllerDirection == Vector2.ZERO:
look_at(get_global_mouse_position())
else:
look_at(global_position+controllerDirection)
rotation += PI / 2
var direction = Input.get_vector("moveLeft", "moveRight", "moveForward", "moveBackward").normalized().rotated(rotation)
if Input.is_action_just_pressed("dash") and dashCooldown.is_stopped():
var direction: Vector2
#if strifeUnlocked:
#direction = Input.get_vector("moveLeft", "moveRight", "moveForward", "moveBackward").normalized().rotated(rotation)
if Globals.touchscreen:
if Input.is_action_pressed("touchscreenForward"):
direction = Vector2.UP.normalized().rotated(rotation) * Input.get_action_strength("touchscreenForward")
else:
direction = Vector2.UP.normalized().rotated(rotation) * Input.get_action_strength("moveForward")
if Input.is_action_just_pressed("dash") and dashCooldown.is_stopped() and dashUnlocked:
dash()
velocity = velocity.lerp(direction * speed, acceleration * delta)
#if Input.is_action_pressed("moveForward") or Input.is_action_pressed("moveLeft") or Input.is_action_pressed("moveRight"):
if Input.is_action_pressed("moveForward") or Input.is_action_pressed("touchscreenForward"):
velocity = velocity.lerp(direction * speed * speedMult, 1 * delta)
move_and_slide()
if timeGhost != null:
moveTimeGhost(global_position, rotation)
setInterface()
func _on_hurt_area_hurt(amount: int) -> void:
damage(amount)
hit.play()
$Camera2D.shake(0.5, 5.0)
if selfHealUnlocked:
selfHealTimer.stop()
selfHealCountdownTimer.start()
func dash():
shortInvincibility()
dashCooldown.start()
global_position += Vector2.UP.rotated(rotation) * 1000
func getRandomSpawnPointPosition() -> Vector2:
var rng = RandomNumberGenerator.new()
print(deg_to_rad(rng.randi_range(0, 360)))
print(Vector2.UP.rotated(deg_to_rad(rng.randi_range(0, 360))) * spawnDistance)
return global_position + Vector2.UP.rotated(deg_to_rad(rng.randi_range(0, 360))) * spawnDistance
#return spawnPointPool.get_children()[rng.randi_range(0, spawnPointPool.get_children().size()-1)].global_position
func addGhost():
var _timeGhost = timeGhostScene.instantiate()
get_tree().get_first_node_in_group("timeGhostPool").add_child(_timeGhost)
addTimeGhost(_timeGhost)
func unlockDash():
dashUnlocked = true
func unlockStrife():
strifeUnlocked = true
func _on_self_heal_countdown_timeout() -> void:
selfHealTimer.start()
func _on_self_heal_timer_timeout() -> void:
if health >= maxHealth:
selfHealTimer.stop()
else:
heal(1)
selfHealTimer.start()
func setInterface():
if dashUnlocked:
$Camera2D/CanvasLayer/Control/VBoxContainer/DashCooldownUi.visible = true
progressBarHealth.value = Globals.getPlayer().health
progressBarSpeed.value = getVelocityMedian()
if dashCooldown.is_stopped():
progressBarDashCooldown.value = 0
else:
progressBarDashCooldown.value = dashCooldown.wait_time - dashCooldown.time_left
if weapon != null:
progressBarWeaponCooldown.value = weapon.cooldownTimer.wait_time - weapon.cooldownTimer.time_left
labelWaveInfo.text = str(Globals.currentWave)
labelWaveEnemiesInfo.text = str(Globals.enemyCount)
labelWaveDestroyedInfo.text = str(Globals.destroyedShips)
func getVelocityMedian() -> float:
var _velocity = velocity
if _velocity.x < 0:
_velocity.x *= -1
if _velocity.y < 0:
_velocity.y *= -1
return (_velocity.x + _velocity.y) / 2
func newUpgrade():
get_tree().paused = true
upgradeChooser.showUpgrades()
func addSpeedMult(mult: float):
if speedMult * mult > maxSpeedMult:
speedMult = maxSpeedMult
Globals.removeSpeedUPgrade()
else:
speedMult *= mult
func switchToMinigun():
changeWeapon(MINIGUN)
progressBarWeaponCooldown.max_value = weapon.cooldown
func switchToShotgun():
changeWeapon(SHOTGUN)
progressBarWeaponCooldown.max_value = weapon.cooldown
func switchToRailgun():
changeWeapon(RAILGUN)
progressBarWeaponCooldown.max_value = weapon.cooldown

View file

@ -1,8 +1,21 @@
[gd_scene load_steps=6 format=3 uid="uid://bmc2exqutt6vu"]
[gd_scene load_steps=19 format=3 uid="uid://bmc2exqutt6vu"]
[ext_resource type="PackedScene" uid="uid://csacin2gx2tum" path="res://scenes/spaceShip/spaceShip.tscn" id="1_nnn47"]
[ext_resource type="Script" uid="uid://0i8gdbb8f6ic" path="res://scenes/spaceShip/player/player.gd" id="2_acneu"]
[ext_resource type="Texture2D" uid="uid://cfwyw1sr6x2np" path="res://icon.svg" id="3_0gv45"]
[ext_resource type="Texture2D" uid="uid://cd5anydes4tv3" path="res://assets/player/shotgunShip.png" id="3_ah1lv"]
[ext_resource type="Texture2D" uid="uid://dlahm782n0awk" path="res://assets/player/minigunShip.png" id="4_1o0bm"]
[ext_resource type="Theme" uid="uid://bcbicfiflkrja" path="res://theme/interface.tres" id="4_o6j0d"]
[ext_resource type="Script" uid="uid://cb4i45ekmd2is" path="res://scenes/spaceShip/player/camera2d.gd" id="4_sk4ix"]
[ext_resource type="Texture2D" uid="uid://dhbn4acw1a6eu" path="res://assets/player/railgunShip.png" id="5_5sy6u"]
[ext_resource type="PackedScene" uid="uid://ha8undpo7d4d" path="res://scenes/upgradeChooser/upgradeChooser.tscn" id="5_nno2o"]
[ext_resource type="Texture2D" uid="uid://bwtb3m00d1gu2" path="res://assets/symbols/heart.png" id="6_sytd6"]
[ext_resource type="Texture2D" uid="uid://cmb78bi27e2jl" path="res://assets/ui/dash.png" id="7_qoa7h"]
[ext_resource type="AudioStream" uid="uid://xldfu6srikfp" path="res://assets/sound/hit.wav" id="7_sma6c"]
[ext_resource type="Script" uid="uid://ds2moov3l1dyk" path="res://scenes/spaceShip/player/input.gd" id="8_5l1u7"]
[ext_resource type="Texture2D" uid="uid://vxl26x3xc8ms" path="res://assets/ui/reload.png" id="8_48lx4"]
[ext_resource type="Texture2D" uid="uid://c0qub1plvyt4x" path="res://assets/ui/move.png" id="10_5l1u7"]
[ext_resource type="Texture2D" uid="uid://bgqfuj6p3h5ad" path="res://assets/ui/attack.png" id="11_5l1u7"]
[ext_resource type="Script" uid="uid://bqykrbwxdktxk" path="res://addons/virtual_joystick/virtual_joystick_instantiator.gd" id="13_1o0bm"]
[sub_resource type="CircleShape2D" id="CircleShape2D_0gv45"]
radius = 56.5685
@ -15,7 +28,11 @@ collision_layer = 12
collision_mask = 3
motion_mode = 1
script = ExtResource("2_acneu")
spawnDistance = 1000
spawnDistance = 5000
shotgunTexture = ExtResource("3_ah1lv")
minigunTexture = ExtResource("4_1o0bm")
railgunTexture = ExtResource("5_5sy6u")
invincible = true
[node name="CollisionShape2D" parent="." index="0"]
shape = SubResource("CircleShape2D_0gv45")
@ -24,30 +41,234 @@ shape = SubResource("CircleShape2D_0gv45")
shape = SubResource("RectangleShape2D_0gv45")
[node name="Sprite2D" parent="." index="2"]
texture = ExtResource("3_0gv45")
position = Vector2(0, -24)
[node name="dashCooldown" type="Timer" parent="." index="5"]
wait_time = 10.0
one_shot = true
autostart = true
[node name="Camera2D" type="Camera2D" parent="." index="6"]
[node name="selfHealTimer" type="Timer" parent="." index="6"]
one_shot = true
[node name="spawnPointPool" type="Node2D" parent="." index="7"]
[node name="selfHealCountdownTimer" type="Timer" parent="." index="7"]
wait_time = 10.0
one_shot = true
[node name="spawnPoint" type="Marker2D" parent="spawnPointPool" index="0"]
position = Vector2(360, -176)
[node name="Camera2D" type="Camera2D" parent="." index="8"]
script = ExtResource("4_sk4ix")
[node name="spawnPoint2" type="Marker2D" parent="spawnPointPool" index="1"]
position = Vector2(392, 256)
[node name="CanvasLayer" type="CanvasLayer" parent="Camera2D" index="0"]
[node name="spawnPoint3" type="Marker2D" parent="spawnPointPool" index="2"]
position = Vector2(-416, 224)
[node name="Control" type="Control" parent="Camera2D/CanvasLayer" index="0"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("4_o6j0d")
[node name="spawnPoint4" type="Marker2D" parent="spawnPointPool" index="3"]
position = Vector2(-408, -168)
[node name="Input" type="Control" parent="Camera2D/CanvasLayer/Control" index="0"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("8_5l1u7")
[node name="Virtual Joystick" type="Control" parent="Camera2D/CanvasLayer/Control/Input" index="0"]
modulate = Color(1, 1, 1, 0.588235)
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -40.0
offset_right = 40.0
grow_vertical = 0
scale = Vector2(2.5, 2.5)
script = ExtResource("13_1o0bm")
metadata/_custom_type_script = "uid://bqykrbwxdktxk"
[node name="MoveButton" type="TouchScreenButton" parent="Camera2D/CanvasLayer/Control/Input" index="1"]
modulate = Color(1, 1, 1, 0.588235)
position = Vector2(1408, 576)
scale = Vector2(14, 14)
texture_normal = ExtResource("10_5l1u7")
action = "touchscreenForward"
[node name="ShootButton" type="TouchScreenButton" parent="Camera2D/CanvasLayer/Control/Input" index="2"]
modulate = Color(1, 1, 1, 0.588235)
position = Vector2(896, 560)
scale = Vector2(14, 14)
texture_normal = ExtResource("11_5l1u7")
action = "attack"
[node name="ShootButtonCorner" type="Control" parent="Camera2D/CanvasLayer/Control/Input" index="3"]
layout_mode = 1
anchor_left = 0.992
anchor_top = 0.985
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -1016.64
offset_top = -495.8
offset_right = -1024.0
offset_bottom = -504.0
grow_horizontal = 0
grow_vertical = 0
[node name="MoveButtonCorner" type="Control" parent="Camera2D/CanvasLayer/Control/Input" index="4"]
layout_mode = 1
anchor_left = 0.992
anchor_top = 0.985
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -504.64
offset_top = -495.8
offset_right = -512.0
offset_bottom = -504.0
grow_horizontal = 0
grow_vertical = 0
[node name="VBoxContainer" type="VBoxContainer" parent="Camera2D/CanvasLayer/Control" index="1"]
layout_mode = 1
offset_left = 64.0
offset_top = 64.0
offset_right = 1096.0
offset_bottom = 238.0
[node name="Weapon" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control/VBoxContainer" index="0"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="Camera2D/CanvasLayer/Control/VBoxContainer/Weapon" index="0"]
layout_mode = 2
[node name="HealthUi" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control/VBoxContainer" index="1"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="Camera2D/CanvasLayer/Control/VBoxContainer/HealthUi" index="0"]
layout_mode = 2
texture = ExtResource("6_sytd6")
expand_mode = 2
[node name="LabelHealth" type="Label" parent="Camera2D/CanvasLayer/Control/VBoxContainer/HealthUi" index="1"]
layout_mode = 2
[node name="ProgressBarHealth" type="ProgressBar" parent="Camera2D/CanvasLayer/Control/VBoxContainer/HealthUi" index="2"]
modulate = Color(1, 0, 0, 1)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
theme_override_font_sizes/font_size = 0
show_percentage = false
[node name="SpeedUi" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control/VBoxContainer" index="2"]
visible = false
layout_mode = 2
[node name="LabelSpeed" type="Label" parent="Camera2D/CanvasLayer/Control/VBoxContainer/SpeedUi" index="0"]
layout_mode = 2
text = "S"
[node name="ProgressBarSpeed" type="ProgressBar" parent="Camera2D/CanvasLayer/Control/VBoxContainer/SpeedUi" index="1"]
layout_mode = 2
size_flags_horizontal = 3
step = 1.0
[node name="DashCooldownUi" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control/VBoxContainer" index="3"]
visible = false
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="Camera2D/CanvasLayer/Control/VBoxContainer/DashCooldownUi" index="0"]
layout_mode = 2
texture = ExtResource("7_qoa7h")
expand_mode = 2
[node name="LabelDashCooldown" type="Label" parent="Camera2D/CanvasLayer/Control/VBoxContainer/DashCooldownUi" index="1"]
layout_mode = 2
[node name="ProgressBarDashCooldown" type="ProgressBar" parent="Camera2D/CanvasLayer/Control/VBoxContainer/DashCooldownUi" index="2"]
modulate = Color(0, 0.172549, 1, 1)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
show_percentage = false
[node name="WeaponCooldown" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control/VBoxContainer" index="4"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="Camera2D/CanvasLayer/Control/VBoxContainer/WeaponCooldown" index="0"]
layout_mode = 2
texture = ExtResource("8_48lx4")
expand_mode = 2
[node name="LabelWeaponCooldown" type="Label" parent="Camera2D/CanvasLayer/Control/VBoxContainer/WeaponCooldown" index="1"]
layout_mode = 2
[node name="ProgressBarWeaponCooldown" type="ProgressBar" parent="Camera2D/CanvasLayer/Control/VBoxContainer/WeaponCooldown" index="2"]
modulate = Color(0.870588, 1, 0, 1)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
show_percentage = false
[node name="HBoxContainer" type="VBoxContainer" parent="Camera2D/CanvasLayer/Control" index="2"]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -560.0
offset_top = 64.0
offset_right = -61.0
offset_bottom = 321.0
grow_horizontal = 0
alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control/HBoxContainer" index="0"]
layout_mode = 2
alignment = 1
[node name="LabelWave" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer/HBoxContainer" index="0"]
layout_mode = 2
text = "WAVE: "
[node name="LabelWaveInfo" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer/HBoxContainer" index="1"]
layout_mode = 2
[node name="HBoxContainer2" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control/HBoxContainer" index="1"]
layout_mode = 2
alignment = 1
[node name="LabelWaveEnemies" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer/HBoxContainer2" index="0"]
layout_mode = 2
text = "Enemies: "
[node name="LabelWaveEnemiesInfo" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer/HBoxContainer2" index="1"]
layout_mode = 2
[node name="HBoxContainer3" type="HBoxContainer" parent="Camera2D/CanvasLayer/Control/HBoxContainer" index="2"]
layout_mode = 2
alignment = 1
[node name="LabelWaveDestroyed" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer/HBoxContainer3" index="0"]
layout_mode = 2
text = "Destroyed: "
[node name="LabelWaveDestroyedInfo" type="Label" parent="Camera2D/CanvasLayer/Control/HBoxContainer/HBoxContainer3" index="1"]
layout_mode = 2
[node name="UpgradeChooser" parent="Camera2D/CanvasLayer/Control" index="3" instance=ExtResource("5_nno2o")]
visible = false
layout_mode = 1
[node name="hit" type="AudioStreamPlayer2D" parent="." index="9"]
stream = ExtResource("7_sma6c")
[connection signal="hurt" from="hurtArea" to="." method="_on_hurt_area_hurt"]
[connection signal="timeout" from="dashCooldown" to="." method="_on_dash_cooldown_timeout"]
[connection signal="timeout" from="selfHealTimer" to="." method="_on_self_heal_timer_timeout"]
[connection signal="timeout" from="selfHealCountdownTimer" to="." method="_on_self_heal_countdown_timeout"]
[editable path="hurtArea"]