diff --git a/Scenes/Levels/level_test.tscn b/Scenes/Levels/level_test.tscn index 33abc78..d0c2ed9 100644 --- a/Scenes/Levels/level_test.tscn +++ b/Scenes/Levels/level_test.tscn @@ -11,10 +11,12 @@ [node name="Decor" type="Node2D" parent="."] [node name="Enemy" parent="." instance=ExtResource("2_ftshv")] -position = Vector2(441, 312) +position = Vector2(497, 324) [node name="BatSpawnable" parent="." instance=ExtResource("3_a1ucf")] position = Vector2(248, 225) +motion_mode = 0 [node name="BatSpawnable2" parent="." instance=ExtResource("3_a1ucf")] position = Vector2(644, 251) +motion_mode = 0 diff --git a/Scenes/Spawnables/AIs/ai_bat.gd b/Scenes/Spawnables/AIs/ai_bat.gd index 03e53f1..39366e1 100644 --- a/Scenes/Spawnables/AIs/ai_bat.gd +++ b/Scenes/Spawnables/AIs/ai_bat.gd @@ -1,4 +1,4 @@ extends AITemplate -func getDirection(position, enemyPosition) -> Vector2: - return Vector2(enemyPosition - position).normalized() +func getDirection(_position, _enemyPosition) -> Vector2: + return Vector2(_enemyPosition - _position).normalized() diff --git a/Scenes/Spawnables/AIs/ai_template.gd b/Scenes/Spawnables/AIs/ai_template.gd index ad017cf..fcfdc42 100644 --- a/Scenes/Spawnables/AIs/ai_template.gd +++ b/Scenes/Spawnables/AIs/ai_template.gd @@ -1,5 +1,5 @@ class_name AITemplate extends Node -func getDirection(position, enemyPosition) -> Vector2: +func getDirection(_position, _enemyPosition) -> Vector2: return Vector2.ZERO diff --git a/Scenes/Spawnables/template_spawnable.gd b/Scenes/Spawnables/template_spawnable.gd index 702b9c4..1377ac1 100644 --- a/Scenes/Spawnables/template_spawnable.gd +++ b/Scenes/Spawnables/template_spawnable.gd @@ -8,10 +8,12 @@ const ATTACK_COOLDOWN : float = 100 @export var speed : float = 0 @export var damage : int = 0 @export var priority : int = 0 +@export var expReward : int = 0 @export var cost : int = 0 @export var minSpawnRange : float = 0 @export var canAttack : bool = true + @onready var ai : Node = $AI @onready var animatedSprite : AnimatedSprite2D = $AnimatedSprite2D @onready var attackArea : Area2D = $AttackArea @@ -41,20 +43,21 @@ func _process(delta): if !isFacingLeft && direction.x < 0: isFacingLeft = true - scale = Vector2(-1, 1) + scale.x = -1 + scale.y = 1 elif isFacingLeft && direction.x > 0: isFacingLeft = false - scale = Vector2(1, 1) + scale.x = -1 + scale.y = -1 velocity = direction * speed * delta move_and_slide() if cooldown > 0: if cooldown - attackSpeed * delta <= 0: - cooldown = 0 + cooldown = 0 else: cooldown -= attackSpeed * delta - attemptAttack() func attemptAttack(): @@ -71,6 +74,7 @@ func attack(): func endAttack(): damageCollision.disabled = true + animatedSprite.disconnect("animation_finished", endAttack) animatedSprite.play("default") func receive_damage(dmg): @@ -103,4 +107,4 @@ func clean(): func _on_damage_area_body_entered(body): if body == enemy: - enemy.receive_damage(damage) + body.receive_damage(damage) diff --git a/Scenes/Spawnables/template_spawnable.tscn b/Scenes/Spawnables/template_spawnable.tscn index 96d9ead..232bc34 100644 --- a/Scenes/Spawnables/template_spawnable.tscn +++ b/Scenes/Spawnables/template_spawnable.tscn @@ -233,6 +233,7 @@ radius = 8.0 [node name="TemplateSpawnable" type="CharacterBody2D"] collision_layer = 6 collision_mask = 6 +motion_mode = 1 script = ExtResource("1_rkej7") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] diff --git a/project.godot b/project.godot index 9335552..b6769b5 100644 --- a/project.godot +++ b/project.godot @@ -19,6 +19,7 @@ config/icon="res://icon.svg" window/size/viewport_width=960 window/size/viewport_height=540 +window/size/mode=4 window/size/resizable=false window/stretch/mode="viewport"