Removed shoot() from controllers. Removed idle animation from laser
This commit is contained in:
@@ -3,7 +3,6 @@ extends Node
|
|||||||
|
|
||||||
|
|
||||||
signal accelerate(direction: Vector2, delta: float)
|
signal accelerate(direction: Vector2, delta: float)
|
||||||
signal shoot()
|
|
||||||
|
|
||||||
|
|
||||||
const FREE_FLIGHT_DIST = 50
|
const FREE_FLIGHT_DIST = 50
|
||||||
@@ -17,8 +16,6 @@ var direction : Vector2
|
|||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if ship.is_on_screen:
|
|
||||||
shoot.emit()
|
|
||||||
accelerate.emit(direction, delta)
|
accelerate.emit(direction, delta)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,15 +4,12 @@ extends Node
|
|||||||
|
|
||||||
signal accelerate(direction: Vector2, delta: float)
|
signal accelerate(direction: Vector2, delta: float)
|
||||||
|
|
||||||
signal shoot()
|
|
||||||
|
|
||||||
signal blink(direction: Vector2)
|
signal blink(direction: Vector2)
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
var input_direction := _get_input_direction()
|
var input_direction := _get_input_direction()
|
||||||
accelerate.emit(input_direction, delta)
|
accelerate.emit(input_direction, delta)
|
||||||
shoot.emit()
|
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
|
|||||||
@@ -11,6 +11,13 @@ var enemy_data : EnemyData:
|
|||||||
@onready var controller : EnemyController = $EnemyController
|
@onready var controller : EnemyController = $EnemyController
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
super._physics_process(delta)
|
||||||
|
|
||||||
|
if is_on_screen:
|
||||||
|
shoot()
|
||||||
|
|
||||||
|
|
||||||
func _add_weapon(weapon: AbstractWeapon, weapon_position: Vector2) -> void:
|
func _add_weapon(weapon: AbstractWeapon, weapon_position: Vector2) -> void:
|
||||||
super._add_weapon(weapon, weapon_position)
|
super._add_weapon(weapon, weapon_position)
|
||||||
weapon.set_belonging(AbstractWeapon.Belonging.ENEMY)
|
weapon.set_belonging(AbstractWeapon.Belonging.ENEMY)
|
||||||
|
|||||||
@@ -1,21 +1,31 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://dwsn0lf1e3578"]
|
[gd_scene load_steps=6 format=3 uid="uid://dwsn0lf1e3578"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://jvyagshykmgb" path="res://game/entities/ships/abstract_ship.tscn" id="1_28j6l"]
|
[ext_resource type="PackedScene" uid="uid://jvyagshykmgb" path="res://game/entities/ships/abstract_ship.tscn" id="1_28j6l"]
|
||||||
[ext_resource type="Script" uid="uid://byicf1t0807pq" path="res://game/entities/ships/enemies/abstract_enemy_ship.gd" id="2_fwvrd"]
|
[ext_resource type="Script" uid="uid://byicf1t0807pq" path="res://game/entities/ships/enemies/abstract_enemy_ship.gd" id="2_fwvrd"]
|
||||||
|
[ext_resource type="Shader" uid="uid://dwh22f35u5qqi" path="res://game/entities/ships/shield.gdshader" id="3_6nnf4"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bsqehbymixust" path="res://game/controllers/enemy_controller.tscn" id="3_l8c0n"]
|
[ext_resource type="PackedScene" uid="uid://bsqehbymixust" path="res://game/controllers/enemy_controller.tscn" id="3_l8c0n"]
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_dlmr1"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
shader = ExtResource("3_6nnf4")
|
||||||
|
shader_parameter/speed = 0.0
|
||||||
|
shader_parameter/scale = 20.0
|
||||||
|
shader_parameter/intensity = 1.0
|
||||||
|
|
||||||
[node name="AbstractEnemyShip" groups=["enemies"] instance=ExtResource("1_28j6l")]
|
[node name="AbstractEnemyShip" groups=["enemies"] instance=ExtResource("1_28j6l")]
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 6
|
collision_mask = 6
|
||||||
script = ExtResource("2_fwvrd")
|
script = ExtResource("2_fwvrd")
|
||||||
weapon_rotation = 180
|
weapon_rotation = 180
|
||||||
|
|
||||||
|
[node name="ArmorSprite" parent="." index="1"]
|
||||||
|
material = SubResource("ShaderMaterial_dlmr1")
|
||||||
|
|
||||||
[node name="EnemyController" parent="." index="4" node_paths=PackedStringArray("ship") instance=ExtResource("3_l8c0n")]
|
[node name="EnemyController" parent="." index="4" node_paths=PackedStringArray("ship") instance=ExtResource("3_l8c0n")]
|
||||||
ship = NodePath("..")
|
ship = NodePath("..")
|
||||||
|
|
||||||
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="." index="5"]
|
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="." index="5"]
|
||||||
|
|
||||||
[connection signal="accelerate" from="EnemyController" to="." method="accelerate"]
|
[connection signal="accelerate" from="EnemyController" to="." method="accelerate"]
|
||||||
[connection signal="shoot" from="EnemyController" to="." method="shoot"]
|
|
||||||
[connection signal="screen_entered" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_entered"]
|
[connection signal="screen_entered" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_entered"]
|
||||||
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]
|
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ func _ready() -> void:
|
|||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
super._physics_process(delta)
|
super._physics_process(delta)
|
||||||
|
|
||||||
|
shoot()
|
||||||
|
|
||||||
if blink_charge < BLINK_CHARGE_MAXIMUM:
|
if blink_charge < BLINK_CHARGE_MAXIMUM:
|
||||||
blink_charge += delta
|
blink_charge += delta
|
||||||
blink_charge_indicator.value = blink_charge
|
blink_charge_indicator.value = blink_charge
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ position = Vector2(-11, 0)
|
|||||||
|
|
||||||
[connection signal="accelerate" from="PlayerController" to="." method="accelerate"]
|
[connection signal="accelerate" from="PlayerController" to="." method="accelerate"]
|
||||||
[connection signal="blink" from="PlayerController" to="." method="_blink"]
|
[connection signal="blink" from="PlayerController" to="." method="_blink"]
|
||||||
[connection signal="shoot" from="PlayerController" to="." method="shoot"]
|
|
||||||
[connection signal="armor_updated" from="Health" to="." method="_on_armor_updated"]
|
[connection signal="armor_updated" from="Health" to="." method="_on_armor_updated"]
|
||||||
[connection signal="hull_updated" from="Health" to="." method="_on_hull_updated"]
|
[connection signal="hull_updated" from="Health" to="." method="_on_hull_updated"]
|
||||||
[connection signal="shield_updated" from="Health" to="." method="_on_shield_updated"]
|
[connection signal="shield_updated" from="Health" to="." method="_on_shield_updated"]
|
||||||
|
|||||||
@@ -1,27 +1,20 @@
|
|||||||
extends AbstractWeapon
|
extends AbstractWeapon
|
||||||
|
|
||||||
|
|
||||||
@onready var idle_sprite : AnimatedSprite2D = $IdleAnimatedSprite
|
@onready var sprite : AnimatedSprite2D = $AnimatedSprite2D
|
||||||
@onready var firing_sprite : AnimatedSprite2D = $FiringAnimatedSprite
|
|
||||||
@onready var cooldown_timer : Timer = $CooldownTimer
|
@onready var cooldown_timer : Timer = $CooldownTimer
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
_switch_sprite(false)
|
|
||||||
|
|
||||||
|
|
||||||
func set_belonging(belonging: Belonging) -> void:
|
func set_belonging(belonging: Belonging) -> void:
|
||||||
super.set_belonging(belonging)
|
super.set_belonging(belonging)
|
||||||
|
|
||||||
idle_sprite.play(PREFIXES[_belonging])
|
sprite.play(PREFIXES[_belonging])
|
||||||
firing_sprite.play(PREFIXES[_belonging])
|
|
||||||
|
|
||||||
|
|
||||||
func shoot(ship_velocity: Vector2) -> bool:
|
func shoot(ship_velocity: Vector2) -> bool:
|
||||||
var is_shot := super.shoot(ship_velocity)
|
var is_shot := super.shoot(ship_velocity)
|
||||||
if is_shot:
|
if is_shot:
|
||||||
_can_shoot = false
|
_can_shoot = false
|
||||||
_switch_sprite(true)
|
|
||||||
cooldown_timer.start()
|
cooldown_timer.start()
|
||||||
|
|
||||||
return is_shot
|
return is_shot
|
||||||
@@ -29,13 +22,3 @@ func shoot(ship_velocity: Vector2) -> bool:
|
|||||||
|
|
||||||
func _on_cooldown_timer_timeout() -> void:
|
func _on_cooldown_timer_timeout() -> void:
|
||||||
_can_shoot = true
|
_can_shoot = true
|
||||||
_switch_sprite(false)
|
|
||||||
|
|
||||||
|
|
||||||
func _switch_sprite(firing: bool) -> void:
|
|
||||||
if firing:
|
|
||||||
idle_sprite.hide()
|
|
||||||
firing_sprite.show()
|
|
||||||
else:
|
|
||||||
idle_sprite.show()
|
|
||||||
firing_sprite.hide()
|
|
||||||
|
|||||||
@@ -1,79 +1,10 @@
|
|||||||
[gd_scene load_steps=23 format=3 uid="uid://def1alrel4ioo"]
|
[gd_scene load_steps=14 format=3 uid="uid://def1alrel4ioo"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://1o2ta17yc5bp" path="res://game/entities/weapons/abstract_weapon.tscn" id="1_pki4x"]
|
[ext_resource type="PackedScene" uid="uid://1o2ta17yc5bp" path="res://game/entities/weapons/abstract_weapon.tscn" id="1_pki4x"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cmni0xrbbfcy5" path="res://game/entities/weapons/laser/laser_projectile.tscn" id="2_fecho"]
|
[ext_resource type="PackedScene" uid="uid://cmni0xrbbfcy5" path="res://game/entities/weapons/laser/laser_projectile.tscn" id="2_fecho"]
|
||||||
[ext_resource type="Script" uid="uid://bxr150at8ul2a" path="res://game/entities/weapons/laser/laser_weapon.gd" id="2_lbdvb"]
|
[ext_resource type="Script" uid="uid://bxr150at8ul2a" path="res://game/entities/weapons/laser/laser_weapon.gd" id="2_lbdvb"]
|
||||||
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="6_c8tb4"]
|
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="6_c8tb4"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4a3il"]
|
|
||||||
atlas = ExtResource("6_c8tb4")
|
|
||||||
region = Rect2(0, 80, 32, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_n1iu2"]
|
|
||||||
atlas = ExtResource("6_c8tb4")
|
|
||||||
region = Rect2(32, 80, 32, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_kgblc"]
|
|
||||||
atlas = ExtResource("6_c8tb4")
|
|
||||||
region = Rect2(64, 80, 32, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_f2vvu"]
|
|
||||||
atlas = ExtResource("6_c8tb4")
|
|
||||||
region = Rect2(96, 80, 32, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7rt33"]
|
|
||||||
atlas = ExtResource("6_c8tb4")
|
|
||||||
region = Rect2(0, 64, 32, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_n02tm"]
|
|
||||||
atlas = ExtResource("6_c8tb4")
|
|
||||||
region = Rect2(32, 64, 32, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7q2cb"]
|
|
||||||
atlas = ExtResource("6_c8tb4")
|
|
||||||
region = Rect2(64, 64, 32, 16)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qatwk"]
|
|
||||||
atlas = ExtResource("6_c8tb4")
|
|
||||||
region = Rect2(96, 64, 32, 16)
|
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_qjjka"]
|
|
||||||
animations = [{
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_4a3il")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_n1iu2")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_kgblc")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_f2vvu")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"enemy",
|
|
||||||
"speed": 10.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_7rt33")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_n02tm")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_7q2cb")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": SubResource("AtlasTexture_qatwk")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"player",
|
|
||||||
"speed": 10.0
|
|
||||||
}]
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dggsl"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_dggsl"]
|
||||||
atlas = ExtResource("6_c8tb4")
|
atlas = ExtResource("6_c8tb4")
|
||||||
region = Rect2(128, 80, 32, 16)
|
region = Rect2(128, 80, 32, 16)
|
||||||
@@ -149,17 +80,12 @@ bullet_per_shot = 2
|
|||||||
Projectile = ExtResource("2_fecho")
|
Projectile = ExtResource("2_fecho")
|
||||||
type = 2
|
type = 2
|
||||||
|
|
||||||
[node name="IdleAnimatedSprite" type="AnimatedSprite2D" parent="." index="0"]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0"]
|
||||||
position = Vector2(3, 0)
|
|
||||||
sprite_frames = SubResource("SpriteFrames_qjjka")
|
|
||||||
animation = &"player"
|
|
||||||
|
|
||||||
[node name="FiringAnimatedSprite" type="AnimatedSprite2D" parent="." index="1"]
|
|
||||||
position = Vector2(3, 0)
|
position = Vector2(3, 0)
|
||||||
sprite_frames = SubResource("SpriteFrames_c8tb4")
|
sprite_frames = SubResource("SpriteFrames_c8tb4")
|
||||||
animation = &"player"
|
animation = &"player"
|
||||||
|
|
||||||
[node name="CooldownTimer" type="Timer" parent="." index="2"]
|
[node name="CooldownTimer" type="Timer" parent="." index="1"]
|
||||||
process_callback = 0
|
process_callback = 0
|
||||||
wait_time = 0.05
|
wait_time = 0.05
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|||||||
Reference in New Issue
Block a user