refactor: change projectile logic
This commit is contained in:
parent
d7bcd07d13
commit
455835d331
29 changed files with 216 additions and 229 deletions
|
|
@ -1,24 +1,9 @@
|
||||||
[gd_scene load_steps=10 format=3 uid="uid://dyl4wiga2goi"]
|
[gd_scene load_steps=7 format=3 uid="uid://dyl4wiga2goi"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dg8bjkjuddnhg" path="res://Enemies/enemy.tscn" id="1_ohyx6"]
|
[ext_resource type="PackedScene" uid="uid://dg8bjkjuddnhg" path="res://Enemies/enemy.tscn" id="1_ohyx6"]
|
||||||
[ext_resource type="Script" uid="uid://dw53e0rr7qc02" path="res://Enemies/boss.gd" id="2_vnmiq"]
|
[ext_resource type="Script" uid="uid://dw53e0rr7qc02" path="res://Enemies/boss.gd" id="2_vnmiq"]
|
||||||
[ext_resource type="Texture2D" uid="uid://d38rvmky1mr5f" path="res://Assets/Characters/72 Character Free/Char 5/Character 5.png" id="3_831fr"]
|
[ext_resource type="Texture2D" uid="uid://d38rvmky1mr5f" path="res://Assets/Characters/72 Character Free/Char 5/Character 5.png" id="3_831fr"]
|
||||||
[ext_resource type="Script" uid="uid://ddgbr0n8kic3y" path="res://Towers/Projectiles/ProjectileResource.gd" id="3_vnmiq"]
|
[ext_resource type="PackedScene" uid="uid://c6i3437fhurkh" path="res://Towers/Projectiles/Scenes/projectile-James.tscn" id="3_vnmiq"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b7jiyk3w5tl02" path="res://Assets/Icones/Spritesheet_Cakes_WITH_OUTLINE.png" id="4_831fr"]
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tviqb"]
|
|
||||||
atlas = ExtResource("4_831fr")
|
|
||||||
region = Rect2(161, 33, 28, 31)
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_831fr"]
|
|
||||||
script = ExtResource("3_vnmiq")
|
|
||||||
speed = 2
|
|
||||||
damage = 3
|
|
||||||
maxTargets = 1
|
|
||||||
type = 4
|
|
||||||
allowedTargets = 2
|
|
||||||
sprite = SubResource("AtlasTexture_tviqb")
|
|
||||||
metadata/_custom_type_script = "uid://ddgbr0n8kic3y"
|
|
||||||
|
|
||||||
[sub_resource type="ViewportTexture" id="ViewportTexture_mw235"]
|
[sub_resource type="ViewportTexture" id="ViewportTexture_mw235"]
|
||||||
viewport_path = NodePath("Enemy/HealthBar3D/SubViewport")
|
viewport_path = NodePath("Enemy/HealthBar3D/SubViewport")
|
||||||
|
|
@ -31,7 +16,8 @@ radius = 2.0
|
||||||
[node name="Enemy" parent="." index="0"]
|
[node name="Enemy" parent="." index="0"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.32, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.32, 0)
|
||||||
script = ExtResource("2_vnmiq")
|
script = ExtResource("2_vnmiq")
|
||||||
projectile = SubResource("Resource_831fr")
|
projectileScene = ExtResource("3_vnmiq")
|
||||||
|
disableTime = 3.0
|
||||||
speed = 0.7
|
speed = 0.7
|
||||||
base_attack_damage = 10
|
base_attack_damage = 10
|
||||||
max_life = 300
|
max_life = 300
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@ extends Enemy
|
||||||
class_name Boss
|
class_name Boss
|
||||||
|
|
||||||
|
|
||||||
@export var projectile : ProjectileResource
|
@export_range(0.1, 15, 0.05, "or_greater") var disableTime : float
|
||||||
|
@export var projectileScene : PackedScene
|
||||||
|
|
||||||
|
|
||||||
func attack() -> bool:
|
func attack() -> bool:
|
||||||
|
|
@ -12,8 +13,11 @@ func attack() -> bool:
|
||||||
|
|
||||||
var towerTargets : Array[Node3D] = targets.filter(func(b): return b is Tower)
|
var towerTargets : Array[Node3D] = targets.filter(func(b): return b is Tower)
|
||||||
if $AttackCooldown.is_stopped() && not towerTargets.is_empty():
|
if $AttackCooldown.is_stopped() && not towerTargets.is_empty():
|
||||||
|
var projectile : Projectile = projectileScene.instantiate()
|
||||||
|
projectile.amount = disableTime
|
||||||
projectile.shoot(towerTargets[0], global_position)
|
projectile.shoot(towerTargets[0], global_position)
|
||||||
targets.erase(towerTargets[0])
|
targets.erase(towerTargets[0])
|
||||||
$AttackCooldown.start()
|
$AttackCooldown.start()
|
||||||
|
return true
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
[ext_resource type="Script" uid="uid://blnmjxmusrsa7" path="res://UI/GameStyleBoxFlat.gd" id="3_07tka"]
|
[ext_resource type="Script" uid="uid://blnmjxmusrsa7" path="res://UI/GameStyleBoxFlat.gd" id="3_07tka"]
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_7frlh"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_7frlh"]
|
||||||
|
radius = 0.3
|
||||||
|
|
||||||
[sub_resource type="ViewportTexture" id="ViewportTexture_cmo2f"]
|
[sub_resource type="ViewportTexture" id="ViewportTexture_cmo2f"]
|
||||||
viewport_path = NodePath("Enemy/HealthBar3D/SubViewport")
|
viewport_path = NodePath("Enemy/HealthBar3D/SubViewport")
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,4 @@ class_name Troop
|
||||||
@export var number_to_spawn : int = 1
|
@export var number_to_spawn : int = 1
|
||||||
@export var lane_to_spawn : int = 0
|
@export var lane_to_spawn : int = 0
|
||||||
@export var spawn_delay : float = 1
|
@export var spawn_delay : float = 1
|
||||||
@export var pack_delay : float = .15
|
@export_range(.15, 5, .01, "or_greater") var pack_delay : float = .15
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
[sub_resource type="Curve3D" id="Curve3D_f1wxt"]
|
[sub_resource type="Curve3D" id="Curve3D_f1wxt"]
|
||||||
_data = {
|
_data = {
|
||||||
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 9.5, 0.25, -5.5, 0, 0, 0, 0, 0, 0, 0.5, 0.25, -5.5, 0, 0, 0, 0, 0, 0, 0.5, 0.25, 0.5, 0, 0, 0, 0, 0, 0, 9.5, 0.25, 0.5),
|
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 9.5, 0, -5.5, 0, 0, 0, 0, 0, 0, 0.5, 0, -5.5, 0, 0, 0, 0, 0, 0, 0.5, 0, 0.5, 0, 0, 0, 0, 0, 0, 9.5, 0, 0.5),
|
||||||
"tilts": PackedFloat32Array(0, 0, 0, 0)
|
"tilts": PackedFloat32Array(0, 0, 0, 0)
|
||||||
}
|
}
|
||||||
point_count = 4
|
point_count = 4
|
||||||
|
|
@ -279,6 +279,7 @@ transform = Transform3D(-1.31134e-07, 0, -3, 0, 3, 0, 3, 0, -1.31134e-07, 3.9764
|
||||||
transform = Transform3D(-2, 0, -1.74846e-07, 0, 2, 0, 1.74846e-07, 0, -2, 9.6873, 0, -5.90881)
|
transform = Transform3D(-2, 0, -1.74846e-07, 0, 2, 0, 1.74846e-07, 0, -2, 9.6873, 0, -5.90881)
|
||||||
|
|
||||||
[node name="Paths" type="Node3D" parent="."]
|
[node name="Paths" type="Node3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.2, 0)
|
||||||
|
|
||||||
[node name="Path 1" type="Path3D" parent="Paths"]
|
[node name="Path 1" type="Path3D" parent="Paths"]
|
||||||
curve = SubResource("Curve3D_f1wxt")
|
curve = SubResource("Curve3D_f1wxt")
|
||||||
|
|
|
||||||
|
|
@ -1,137 +1,136 @@
|
||||||
extends CharacterBody3D
|
extends CharacterBody3D
|
||||||
class_name Projectile
|
class_name Projectile
|
||||||
|
|
||||||
const TARGET_ENEMY : int = 1 ## Flag to target enemy
|
|
||||||
const TARGET_ALLY : int = 2 ## Flag to target ally
|
|
||||||
|
|
||||||
|
enum MODE {
|
||||||
enum TYPE { ## Types of projectiles
|
FOLLOW, ## Follow Entity
|
||||||
|
LOCATION, ## Go to entity location
|
||||||
## One target
|
HITSCAN, ## DANGER NOT implemented yet
|
||||||
BASIC,
|
|
||||||
|
|
||||||
## Multiple targets[br]work with [member ProjectileResource.damageArea]
|
|
||||||
AOE,
|
|
||||||
|
|
||||||
## Piercing through enemies[br]work with [member ProjectileResource.maxTarets] and [member ProjectileResource.damageArea]
|
|
||||||
PIERCING,
|
|
||||||
|
|
||||||
## Bouncing over enemies[br]work with [member ProjectileResource.maxTarets] and [member ProjectileResource.damageArea]
|
|
||||||
BOUNCING,
|
|
||||||
|
|
||||||
## Disable ally tower for [param damage] duration [br]Usable on [Boss] projectiles
|
|
||||||
DISABLING,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var type : TYPE = TYPE.BASIC
|
enum TYPE { ## Types of projectiles
|
||||||
var speed : int = 20
|
BASIC, ## One target
|
||||||
var allowedTargets : int = TARGET_ENEMY
|
AOE, ## Multiple targets[br]work with [member damageArea]
|
||||||
|
PIERCING, ## Piercing through enemies[br]work with [member maxTarets] and [member damageArea]
|
||||||
|
BOUNCING, ## Bouncing over enemies[br]work with [member maxTarets] and [member damageArea]
|
||||||
|
DISABLING, ## Disable ally tower for [member damage] duration [br]Usable on [Boss] projectiles
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@export var type : TYPE = TYPE.BASIC
|
||||||
|
@export var mode : MODE = MODE.FOLLOW
|
||||||
|
@export var speed : int
|
||||||
|
@export var maxTargets : int = 1
|
||||||
|
|
||||||
|
|
||||||
|
var amount : float
|
||||||
var target : PhysicsBody3D
|
var target : PhysicsBody3D
|
||||||
var vectorTarget : Vector3
|
var vectorTarget : Vector3
|
||||||
var maxTargets : int = 1
|
var bodiesInRange : Array[Node3D]
|
||||||
var damage : int = 1
|
var affectedTarget : Array[Node3D]
|
||||||
var bodiesInRange : Array[Enemy]
|
|
||||||
var affectedTarget : Array[Enemy]
|
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(_delta: float) -> void:
|
func _physics_process(_delta: float) -> void:
|
||||||
|
if mode == MODE.LOCATION && vectorTarget.distance_squared_to(global_position) < .4:
|
||||||
|
resolveContact()
|
||||||
|
maxTargets = 0 # Ensure queue free in next if
|
||||||
|
|
||||||
if shouldQueueFree():
|
if shouldQueueFree():
|
||||||
queue_free()
|
queue_free()
|
||||||
return
|
return
|
||||||
|
|
||||||
var globalPos : Vector3 = vectorTarget if vectorTarget else target.global_position
|
var globalPos : Vector3 = vectorTarget if vectorTarget else target.global_position
|
||||||
if target is Tower:
|
if target:
|
||||||
globalPos.y += Helper.getHitBoxLocation(target, Helper.POSITION.CENTER)
|
globalPos.y += Helper.getHitBoxLocation(target, Helper.POSITION.CENTER)
|
||||||
velocity = global_position.direction_to(globalPos) * speed
|
|
||||||
look_at(globalPos)
|
look_at(globalPos)
|
||||||
|
velocity = global_position.direction_to(globalPos) * speed
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
|
||||||
|
|
||||||
func shouldQueueFree() -> bool:
|
func shouldQueueFree() -> bool:
|
||||||
match type:
|
if maxTargets < 1:
|
||||||
TYPE.PIERCING: return vectorTarget.distance_squared_to(global_position) < .4
|
return true
|
||||||
_ when allowedTargets & TARGET_ALLY && target is Tower: return not target.visible
|
|
||||||
_ when !is_instance_valid(target): return true
|
if !is_instance_valid(target):
|
||||||
|
return mode == MODE.FOLLOW
|
||||||
|
elif target is Tower:
|
||||||
|
return not target.visible
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|
||||||
func onBodyEnteredDamageArea(body: Node3D) -> void:
|
func onBodyEnteredDamageArea(body: Node3D) -> void:
|
||||||
if type != TYPE.BASIC && targetable(body):
|
if type != TYPE.BASIC && targetable(body):
|
||||||
|
addBodyInRange(body)
|
||||||
if type == TYPE.PIERCING:
|
if type == TYPE.PIERCING:
|
||||||
resolveContact(body)
|
resolveContact()
|
||||||
elif not bodiesInRange.has(body):
|
|
||||||
bodiesInRange.append(body)
|
|
||||||
|
|
||||||
|
|
||||||
func onBodyCollideWithProjectile(body: Node3D) -> void:
|
func onBodyCollideWithProjectile(body: Node3D) -> void:
|
||||||
if (body == target || type == TYPE.PIERCING && targetable(body)):
|
if mode != MODE.LOCATION && (body == target || type == TYPE.PIERCING) && targetable(body):
|
||||||
resolveContact(body)
|
addBodyInRange(body, true)
|
||||||
|
resolveContact()
|
||||||
|
|
||||||
|
|
||||||
|
func addBodyInRange(body: Node3D, pushFront: bool = false) -> void:
|
||||||
|
var idx : int = bodiesInRange.find(body)
|
||||||
|
|
||||||
|
if pushFront:
|
||||||
|
if idx != -1:
|
||||||
|
bodiesInRange.remove_at(idx)
|
||||||
|
bodiesInRange.push_front(body)
|
||||||
|
elif idx == -1:
|
||||||
|
bodiesInRange.push_back(body)
|
||||||
|
|
||||||
|
|
||||||
func targetable(body: Node3D) -> bool:
|
func targetable(body: Node3D) -> bool:
|
||||||
if body is Enemy:
|
return not affectedTarget.has(body)
|
||||||
return TARGET_ENEMY & allowedTargets && not affectedTarget.has(body)
|
|
||||||
if body is Tower || body is TheCube:
|
|
||||||
return TARGET_ALLY & allowedTargets
|
|
||||||
|
|
||||||
return false
|
|
||||||
|
|
||||||
|
|
||||||
func resolveContact(body: Node3D) -> void:
|
func resolveContact() -> void:
|
||||||
if body is Enemy:
|
if bodiesInRange.is_empty():
|
||||||
resolveEnemyDamages(body)
|
return
|
||||||
if body is Tower || body is TheCube:
|
|
||||||
resolveAllyEffects(body)
|
resolveEffect(bodiesInRange[0])
|
||||||
|
|
||||||
|
match type:
|
||||||
|
TYPE.AOE:
|
||||||
|
for _body in bodiesInRange:
|
||||||
|
if is_instance_valid(_body):
|
||||||
|
resolveEffect(_body)
|
||||||
|
|
||||||
|
TYPE.BOUNCING:
|
||||||
|
print(bodiesInRange)
|
||||||
|
target = null if bodiesInRange.is_empty() else bodiesInRange[0]
|
||||||
|
|
||||||
|
|
||||||
func resolveEnemyDamages(enemy: Enemy) -> void:
|
func resolveEffect(body : Node3D) -> void:
|
||||||
damageEnemy(enemy)
|
bodiesInRange.erase(body)
|
||||||
|
if affectedTarget.has(body) || body is GameTile:
|
||||||
|
return
|
||||||
|
|
||||||
if type == TYPE.AOE:
|
if type == TYPE.DISABLING && body.has_method("disable"):
|
||||||
for body in bodiesInRange:
|
body.disable(amount)
|
||||||
if is_instance_valid(body):
|
elif body.has_method("take_damage"):
|
||||||
damageEnemy(body)
|
body.take_damage(amount)
|
||||||
|
|
||||||
if maxTargets < 1 || type == TYPE.AOE:
|
affectedTarget.append(body)
|
||||||
return queue_free()
|
|
||||||
|
|
||||||
if type == TYPE.BOUNCING:
|
|
||||||
bodiesInRange.erase(enemy)
|
|
||||||
if bodiesInRange.size():
|
|
||||||
target = bodiesInRange.pop_front()
|
|
||||||
else:
|
|
||||||
queue_free()
|
|
||||||
|
|
||||||
|
|
||||||
func resolveAllyEffects(ally: Node3D) -> void:
|
|
||||||
if ally is Tower && type == TYPE.DISABLING:
|
|
||||||
ally.disable(damage)
|
|
||||||
queue_free()
|
|
||||||
|
|
||||||
|
|
||||||
func damageEnemy(enemy: Enemy) -> void:
|
|
||||||
if not affectedTarget.has(enemy):
|
|
||||||
maxTargets -= 1
|
maxTargets -= 1
|
||||||
enemy.take_damage(damage)
|
|
||||||
affectedTarget.append(enemy)
|
|
||||||
|
|
||||||
|
|
||||||
func loadProjectile(resource: ProjectileResource, _target: PhysicsBody3D) -> void:
|
|
||||||
target = _target
|
|
||||||
type = resource.type
|
|
||||||
if type == TYPE.PIERCING:
|
|
||||||
vectorTarget = target.global_position
|
|
||||||
# NOTE removing colision layer for pierce effect
|
|
||||||
$HitBox.collision_layer = 0
|
|
||||||
speed = resource.speed
|
|
||||||
maxTargets = resource.maxTargets
|
|
||||||
damage = resource.damage
|
|
||||||
allowedTargets = resource.allowedTargets
|
|
||||||
$Sprite3D.texture = resource.sprite
|
|
||||||
if [TYPE.AOE, TYPE.PIERCING, TYPE.BOUNCING].has(type) && resource.damageArea:
|
|
||||||
$DamageArea/ProjectileArea.shape = resource.damageArea
|
|
||||||
|
|
||||||
|
|
||||||
func removeTarget(body: Node3D) -> void:
|
func removeTarget(body: Node3D) -> void:
|
||||||
bodiesInRange.erase(body)
|
bodiesInRange.erase(body)
|
||||||
|
|
||||||
|
|
||||||
|
func shoot(_target: Node3D, globalPos: Vector3) -> void:
|
||||||
|
target = _target
|
||||||
|
|
||||||
|
match mode:
|
||||||
|
Projectile.MODE.HITSCAN:
|
||||||
|
globalPos = target.global_position
|
||||||
|
globalPos.y += Helper.getHitBoxLocation(target, Helper.POSITION.CENTER)
|
||||||
|
Projectile.MODE.LOCATION:
|
||||||
|
vectorTarget = target.global_position
|
||||||
|
vectorTarget.y += Helper.getHitBoxLocation(target, Helper.POSITION.CENTER)
|
||||||
|
|
||||||
|
EventBus.projectile_shooted.emit(self, globalPos)
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
extends Resource
|
|
||||||
class_name ProjectileResource
|
|
||||||
|
|
||||||
const projectileScene : PackedScene = preload("res://Towers/Projectiles/projectile.tscn")
|
|
||||||
|
|
||||||
@export var speed : int = 20
|
|
||||||
@export var damage : int = 1
|
|
||||||
@export var maxTargets : int = 1 ## Usefull when [enum Projectile.TYPE] is [param PIERCING] or [param BOUNCING]
|
|
||||||
@export var type : Projectile.TYPE = Projectile.TYPE.BASIC
|
|
||||||
@export_flags("Enemies", "Alliés") var allowedTargets : int = 1
|
|
||||||
## Usefull when [enum Projectile.TYPE] is [param AOE], [param PIERCING] or [param BOUNCING]
|
|
||||||
## When [enum Projectile.TYPE] is [param BOUNCING] the shape is for target new entity in range
|
|
||||||
@export var damageArea : Shape3D
|
|
||||||
@export var sprite : Texture2D = load("res://Assets/Emotes/emote_star.png")
|
|
||||||
|
|
||||||
func shoot(target: Node3D, gobalPos: Vector3) -> void:
|
|
||||||
var projectile : Projectile = projectileScene.instantiate()
|
|
||||||
projectile.loadProjectile(self, target)
|
|
||||||
EventBus.projectile_shooted.emit(projectile, gobalPos)
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
uid://ddgbr0n8kic3y
|
|
||||||
21
Towers/Projectiles/Scenes/projectile-Aline.tscn
Normal file
21
Towers/Projectiles/Scenes/projectile-Aline.tscn
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://dcnm6rjht0rew"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://oykrff3g74eo" path="res://Towers/Projectiles/projectile.tscn" id="1_4tmpc"]
|
||||||
|
|
||||||
|
[sub_resource type="SphereShape3D" id="SphereShape3D_k24mn"]
|
||||||
|
radius = 0.3
|
||||||
|
|
||||||
|
[node name="Projectile" instance=ExtResource("1_4tmpc")]
|
||||||
|
type = 1
|
||||||
|
mode = 1
|
||||||
|
speed = 3
|
||||||
|
damage = 6
|
||||||
|
|
||||||
|
[node name="HitBox" parent="." index="2"]
|
||||||
|
collision_mask = 2
|
||||||
|
|
||||||
|
[node name="DamageArea" parent="." index="3"]
|
||||||
|
collision_mask = 2
|
||||||
|
|
||||||
|
[node name="Node" type="CollisionShape3D" parent="DamageArea" index="0"]
|
||||||
|
shape = SubResource("SphereShape3D_k24mn")
|
||||||
19
Towers/Projectiles/Scenes/projectile-James.tscn
Normal file
19
Towers/Projectiles/Scenes/projectile-James.tscn
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://c6i3437fhurkh"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://oykrff3g74eo" path="res://Towers/Projectiles/projectile.tscn" id="1_do0ca"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b7jiyk3w5tl02" path="res://Assets/Icones/Spritesheet_Cakes_WITH_OUTLINE.png" id="2_ckawd"]
|
||||||
|
|
||||||
|
[node name="Projectile" instance=ExtResource("1_do0ca")]
|
||||||
|
type = 4
|
||||||
|
speed = 2
|
||||||
|
damage = 3
|
||||||
|
|
||||||
|
[node name="Sprite3D" parent="." index="1"]
|
||||||
|
transform = Transform3D(1.3, 0, 0, 0, 1.3, 0, 0, 0, 1.3, 0, 0, 0)
|
||||||
|
texture = ExtResource("2_ckawd")
|
||||||
|
hframes = 6
|
||||||
|
vframes = 2
|
||||||
|
frame = 11
|
||||||
|
|
||||||
|
[node name="HitBox" parent="." index="2"]
|
||||||
|
collision_mask = 4
|
||||||
10
Towers/Projectiles/Scenes/projectile-Pierre.tscn
Normal file
10
Towers/Projectiles/Scenes/projectile-Pierre.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://dy755v20lqu7q"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://oykrff3g74eo" path="res://Towers/Projectiles/projectile.tscn" id="1_d01p1"]
|
||||||
|
|
||||||
|
[node name="Projectile" instance=ExtResource("1_d01p1")]
|
||||||
|
speed = 15
|
||||||
|
damage = 2
|
||||||
|
|
||||||
|
[node name="HitBox" parent="." index="2"]
|
||||||
|
collision_mask = 2
|
||||||
20
Towers/Projectiles/Scenes/projectile-Victoria.tscn
Normal file
20
Towers/Projectiles/Scenes/projectile-Victoria.tscn
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://df8u7dogl4wi0"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://oykrff3g74eo" path="res://Towers/Projectiles/projectile.tscn" id="1_suva6"]
|
||||||
|
|
||||||
|
[sub_resource type="SphereShape3D" id="SphereShape3D_k24mn"]
|
||||||
|
radius = 1.5
|
||||||
|
|
||||||
|
[node name="Projectile" instance=ExtResource("1_suva6")]
|
||||||
|
type = 3
|
||||||
|
speed = 5
|
||||||
|
maxTargets = 3
|
||||||
|
|
||||||
|
[node name="HitBox" parent="." index="2"]
|
||||||
|
collision_mask = 2
|
||||||
|
|
||||||
|
[node name="DamageArea" parent="." index="3"]
|
||||||
|
collision_mask = 2
|
||||||
|
|
||||||
|
[node name="Node" type="CollisionShape3D" parent="DamageArea" index="0"]
|
||||||
|
shape = SubResource("SphereShape3D_k24mn")
|
||||||
|
|
@ -10,6 +10,8 @@ radius = 0.1
|
||||||
radius = 0.1
|
radius = 0.1
|
||||||
|
|
||||||
[node name="Projectile" type="CharacterBody3D"]
|
[node name="Projectile" type="CharacterBody3D"]
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 0
|
||||||
script = ExtResource("1_ggq0q")
|
script = ExtResource("1_ggq0q")
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
|
|
@ -22,7 +24,7 @@ texture = ExtResource("2_08w86")
|
||||||
|
|
||||||
[node name="HitBox" type="Area3D" parent="."]
|
[node name="HitBox" type="Area3D" parent="."]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 6
|
collision_mask = 0
|
||||||
|
|
||||||
[node name="ProjectileSize" type="CollisionShape3D" parent="HitBox"]
|
[node name="ProjectileSize" type="CollisionShape3D" parent="HitBox"]
|
||||||
shape = SubResource("SphereShape3D_dsts2")
|
shape = SubResource("SphereShape3D_dsts2")
|
||||||
|
|
@ -30,10 +32,7 @@ debug_color = Color(0.926858, 0.237749, 0.335021, 0.42)
|
||||||
|
|
||||||
[node name="DamageArea" type="Area3D" parent="."]
|
[node name="DamageArea" type="Area3D" parent="."]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 6
|
collision_mask = 0
|
||||||
|
|
||||||
[node name="ProjectileArea" type="CollisionShape3D" parent="DamageArea"]
|
|
||||||
debug_color = Color(0.926858, 0.237749, 0.335021, 0.42)
|
|
||||||
|
|
||||||
[connection signal="body_entered" from="HitBox" to="." method="onBodyCollideWithProjectile" flags=3]
|
[connection signal="body_entered" from="HitBox" to="." method="onBodyCollideWithProjectile" flags=3]
|
||||||
[connection signal="body_entered" from="DamageArea" to="." method="onBodyEnteredDamageArea"]
|
[connection signal="body_entered" from="DamageArea" to="." method="onBodyEnteredDamageArea"]
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,9 @@
|
||||||
[gd_scene load_steps=10 format=3 uid="uid://ck1qryleu80s"]
|
[gd_scene load_steps=7 format=3 uid="uid://ck1qryleu80s"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_gvvig"]
|
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_gvvig"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cob1lydkirn20" path="res://Assets/Icones/raccoon-head.svg" id="3_6h033"]
|
[ext_resource type="Texture2D" uid="uid://cob1lydkirn20" path="res://Assets/Icones/raccoon-head.svg" id="3_6h033"]
|
||||||
[ext_resource type="Script" uid="uid://ddgbr0n8kic3y" path="res://Towers/Projectiles/ProjectileResource.gd" id="4_ck6a3"]
|
[ext_resource type="PackedScene" uid="uid://dcnm6rjht0rew" path="res://Towers/Projectiles/Scenes/projectile-Aline.tscn" id="5_6bcjo"]
|
||||||
[ext_resource type="Texture2D" uid="uid://315k07rsgf6t" path="res://Assets/Characters/Female1.png" id="5_l514g"]
|
[ext_resource type="Texture2D" uid="uid://315k07rsgf6t" path="res://Assets/Characters/Female1.png" id="5_l514g"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dqyhhvxpwtpsy" path="res://Assets/Emotes/emote_star.png" id="5_lhd8w"]
|
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_lhd8w"]
|
|
||||||
radius = 0.2
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_lhd8w"]
|
|
||||||
script = ExtResource("4_ck6a3")
|
|
||||||
speed = 3
|
|
||||||
damage = 6
|
|
||||||
maxTargets = 1
|
|
||||||
type = 1
|
|
||||||
allowedTargets = 1
|
|
||||||
damageArea = SubResource("SphereShape3D_lhd8w")
|
|
||||||
sprite = ExtResource("5_lhd8w")
|
|
||||||
metadata/_custom_type_script = "uid://ddgbr0n8kic3y"
|
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_6bcjo"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_6bcjo"]
|
||||||
radius = 3.0
|
radius = 3.0
|
||||||
|
|
@ -32,7 +17,8 @@ type = 2
|
||||||
icone = ExtResource("3_6h033")
|
icone = ExtResource("3_6h033")
|
||||||
bio = ""
|
bio = ""
|
||||||
price = 150
|
price = 150
|
||||||
projectile = SubResource("Resource_lhd8w")
|
damage = 6
|
||||||
|
projectileScene = ExtResource("5_6bcjo")
|
||||||
towerRange = SubResource("SphereShape3D_6bcjo")
|
towerRange = SubResource("SphereShape3D_6bcjo")
|
||||||
action_cooldown = 2.5
|
action_cooldown = 2.5
|
||||||
max_energy = 100.0
|
max_energy = 100.0
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,20 @@
|
||||||
[gd_scene load_steps=7 format=3 uid="uid://c4ta0aynybpis"]
|
[gd_scene load_steps=5 format=3 uid="uid://c4ta0aynybpis"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_yctfx"]
|
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_yctfx"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dwwgho6f8f4kj" path="res://Assets/Icones/penguin.svg" id="2_5uh04"]
|
[ext_resource type="Texture2D" uid="uid://dwwgho6f8f4kj" path="res://Assets/Icones/penguin.svg" id="2_5uh04"]
|
||||||
[ext_resource type="Script" uid="uid://ddgbr0n8kic3y" path="res://Towers/Projectiles/ProjectileResource.gd" id="3_gr7yf"]
|
|
||||||
[ext_resource type="Script" uid="uid://bg0x4egeu17qb" path="res://Upgrades/TowerUpgrade.gd" id="4_v32j5"]
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_mf185"]
|
|
||||||
script = ExtResource("3_gr7yf")
|
|
||||||
speed = 20
|
|
||||||
damage = 1
|
|
||||||
maxTargets = 1
|
|
||||||
type = 1
|
|
||||||
allowedTargets = 1
|
|
||||||
metadata/_custom_type_script = "uid://ddgbr0n8kic3y"
|
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_y05yr"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_y05yr"]
|
||||||
radius = 4.0
|
radius = 4.0
|
||||||
|
|
||||||
|
[sub_resource type="ViewportTexture" id="ViewportTexture_fegyx"]
|
||||||
|
viewport_path = NodePath("EnergyBar3D/SubViewport")
|
||||||
|
|
||||||
[node name="Evan" instance=ExtResource("1_yctfx")]
|
[node name="Evan" instance=ExtResource("1_yctfx")]
|
||||||
tower_name = "Evan"
|
tower_name = "Evan"
|
||||||
type = 5
|
type = 5
|
||||||
icone = ExtResource("2_5uh04")
|
icone = ExtResource("2_5uh04")
|
||||||
bio = ""
|
bio = ""
|
||||||
projectile = SubResource("Resource_mf185")
|
|
||||||
towerRange = SubResource("SphereShape3D_y05yr")
|
towerRange = SubResource("SphereShape3D_y05yr")
|
||||||
tower_shop = Array[ExtResource("4_v32j5")]([])
|
|
||||||
|
[node name="EnergyBar3D" parent="." index="6"]
|
||||||
|
texture = SubResource("ViewportTexture_fegyx")
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_bw8ui"]
|
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_bw8ui"]
|
||||||
[ext_resource type="Texture2D" uid="uid://d4pdmbhhlphc" path="res://Assets/Icones/seated-mouse.svg" id="2_1pop4"]
|
[ext_resource type="Texture2D" uid="uid://d4pdmbhhlphc" path="res://Assets/Icones/seated-mouse.svg" id="2_1pop4"]
|
||||||
[ext_resource type="Script" uid="uid://bg0x4egeu17qb" path="res://Upgrades/TowerUpgrade.gd" id="4_nxn76"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://315k07rsgf6t" path="res://Assets/Characters/Female1.png" id="5_kbhva"]
|
[ext_resource type="Texture2D" uid="uid://315k07rsgf6t" path="res://Assets/Characters/Female1.png" id="5_kbhva"]
|
||||||
|
|
||||||
[node name="Geraldine" instance=ExtResource("1_bw8ui")]
|
[node name="Geraldine" instance=ExtResource("1_bw8ui")]
|
||||||
|
|
@ -10,7 +9,6 @@ tower_name = "Geraldine"
|
||||||
type = 7
|
type = 7
|
||||||
icone = ExtResource("2_1pop4")
|
icone = ExtResource("2_1pop4")
|
||||||
bio = ""
|
bio = ""
|
||||||
tower_shop = Array[ExtResource("4_nxn76")]([])
|
|
||||||
|
|
||||||
[node name="Sprite3D" parent="." index="5"]
|
[node name="Sprite3D" parent="." index="5"]
|
||||||
texture = ExtResource("5_kbhva")
|
texture = ExtResource("5_kbhva")
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,8 @@
|
||||||
[gd_scene load_steps=8 format=3 uid="uid://b1pg1hgysx3am"]
|
[gd_scene load_steps=5 format=3 uid="uid://b1pg1hgysx3am"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_laam8"]
|
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_laam8"]
|
||||||
[ext_resource type="Script" uid="uid://ddgbr0n8kic3y" path="res://Towers/Projectiles/ProjectileResource.gd" id="2_7fox5"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://boxdrq4nrq7hv" path="res://Assets/Icones/flamingo.svg" id="2_sciv6"]
|
[ext_resource type="Texture2D" uid="uid://boxdrq4nrq7hv" path="res://Assets/Icones/flamingo.svg" id="2_sciv6"]
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_sciv6"]
|
|
||||||
radius = 0.2
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_sciv6"]
|
|
||||||
script = ExtResource("2_7fox5")
|
|
||||||
speed = 40
|
|
||||||
damage = 10
|
|
||||||
maxTargets = 5
|
|
||||||
type = 2
|
|
||||||
allowedTargets = 1
|
|
||||||
damageArea = SubResource("SphereShape3D_sciv6")
|
|
||||||
metadata/_custom_type_script = "uid://ddgbr0n8kic3y"
|
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_pw4mj"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_pw4mj"]
|
||||||
radius = 10.0
|
radius = 10.0
|
||||||
|
|
||||||
|
|
@ -29,10 +15,11 @@ type = 3
|
||||||
icone = ExtResource("2_sciv6")
|
icone = ExtResource("2_sciv6")
|
||||||
bio = ""
|
bio = ""
|
||||||
price = 200
|
price = 200
|
||||||
projectile = SubResource("Resource_sciv6")
|
damage = 10
|
||||||
towerRange = SubResource("SphereShape3D_pw4mj")
|
towerRange = SubResource("SphereShape3D_pw4mj")
|
||||||
action_cooldown = 3.0
|
action_cooldown = 3.0
|
||||||
max_energy = 50.0
|
max_energy = 50.0
|
||||||
|
energy_regen = 10.0
|
||||||
energy_cost = 25.0
|
energy_cost = 25.0
|
||||||
|
|
||||||
[node name="Sprite3D" parent="." index="5"]
|
[node name="Sprite3D" parent="." index="5"]
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,11 @@
|
||||||
[gd_scene load_steps=14 format=3 uid="uid://bj6srer7ghf7p"]
|
[gd_scene load_steps=12 format=3 uid="uid://bj6srer7ghf7p"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_s6dfo"]
|
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_s6dfo"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bb4wihq1n1wm7" path="res://Assets/Icones/labrador-head.svg" id="2_lcjqw"]
|
[ext_resource type="Texture2D" uid="uid://bb4wihq1n1wm7" path="res://Assets/Icones/labrador-head.svg" id="2_lcjqw"]
|
||||||
[ext_resource type="Script" uid="uid://ddgbr0n8kic3y" path="res://Towers/Projectiles/ProjectileResource.gd" id="3_5tgsk"]
|
[ext_resource type="PackedScene" uid="uid://dy755v20lqu7q" path="res://Towers/Projectiles/Scenes/projectile-Pierre.tscn" id="5_wnw3f"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dqyhhvxpwtpsy" path="res://Assets/Emotes/emote_star.png" id="4_r52mr"]
|
|
||||||
[ext_resource type="Script" uid="uid://bg0x4egeu17qb" path="res://Upgrades/TowerUpgrade.gd" id="5_wvh05"]
|
[ext_resource type="Script" uid="uid://bg0x4egeu17qb" path="res://Upgrades/TowerUpgrade.gd" id="5_wvh05"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dqvou7t7o1t5d" path="res://Assets/Icones/medal2.png" id="6_wnw3f"]
|
[ext_resource type="Texture2D" uid="uid://dqvou7t7o1t5d" path="res://Assets/Icones/medal2.png" id="6_wnw3f"]
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_r52mr"]
|
|
||||||
script = ExtResource("3_5tgsk")
|
|
||||||
speed = 15
|
|
||||||
damage = 2
|
|
||||||
maxTargets = 1
|
|
||||||
type = 0
|
|
||||||
allowedTargets = 1
|
|
||||||
sprite = ExtResource("4_r52mr")
|
|
||||||
metadata/_custom_type_script = "uid://ddgbr0n8kic3y"
|
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_c55ds"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_c55ds"]
|
||||||
radius = 2.0
|
radius = 2.0
|
||||||
|
|
||||||
|
|
@ -86,7 +75,8 @@ tower_name = "Pierre"
|
||||||
type = 1
|
type = 1
|
||||||
icone = ExtResource("2_lcjqw")
|
icone = ExtResource("2_lcjqw")
|
||||||
price = 100
|
price = 100
|
||||||
projectile = SubResource("Resource_r52mr")
|
damage = 2
|
||||||
|
projectileScene = ExtResource("5_wnw3f")
|
||||||
towerRange = SubResource("SphereShape3D_c55ds")
|
towerRange = SubResource("SphereShape3D_c55ds")
|
||||||
action_cooldown = 1.0
|
action_cooldown = 1.0
|
||||||
max_energy = 25.0
|
max_energy = 25.0
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,10 @@
|
||||||
[gd_scene load_steps=9 format=3 uid="uid://db6aq2wdrcjtp"]
|
[gd_scene load_steps=7 format=3 uid="uid://db6aq2wdrcjtp"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_ki73m"]
|
[ext_resource type="PackedScene" uid="uid://trg7ag3dqr2l" path="res://Towers/tower.tscn" id="1_ki73m"]
|
||||||
[ext_resource type="Texture2D" uid="uid://m6jwakrus50v" path="res://Assets/Icones/sea-star.svg" id="2_n34tq"]
|
[ext_resource type="Texture2D" uid="uid://m6jwakrus50v" path="res://Assets/Icones/sea-star.svg" id="2_n34tq"]
|
||||||
[ext_resource type="Script" uid="uid://ddgbr0n8kic3y" path="res://Towers/Projectiles/ProjectileResource.gd" id="3_sf52i"]
|
[ext_resource type="PackedScene" uid="uid://df8u7dogl4wi0" path="res://Towers/Projectiles/Scenes/projectile-Victoria.tscn" id="4_sf52i"]
|
||||||
[ext_resource type="Texture2D" uid="uid://315k07rsgf6t" path="res://Assets/Characters/Female1.png" id="5_2rqsg"]
|
[ext_resource type="Texture2D" uid="uid://315k07rsgf6t" path="res://Assets/Characters/Female1.png" id="5_2rqsg"]
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_rbuca"]
|
|
||||||
radius = 3.0
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_c1yif"]
|
|
||||||
script = ExtResource("3_sf52i")
|
|
||||||
speed = 5
|
|
||||||
damage = 5
|
|
||||||
maxTargets = 3
|
|
||||||
type = 3
|
|
||||||
allowedTargets = 1
|
|
||||||
damageArea = SubResource("SphereShape3D_rbuca")
|
|
||||||
metadata/_custom_type_script = "uid://ddgbr0n8kic3y"
|
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_sf52i"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_sf52i"]
|
||||||
radius = 4.0
|
radius = 4.0
|
||||||
|
|
||||||
|
|
@ -29,10 +16,14 @@ tower_name = "Victoria"
|
||||||
type = 4
|
type = 4
|
||||||
icone = ExtResource("2_n34tq")
|
icone = ExtResource("2_n34tq")
|
||||||
bio = ""
|
bio = ""
|
||||||
projectile = SubResource("Resource_c1yif")
|
price = 666
|
||||||
|
damage = 5
|
||||||
|
projectileScene = ExtResource("4_sf52i")
|
||||||
towerRange = SubResource("SphereShape3D_sf52i")
|
towerRange = SubResource("SphereShape3D_sf52i")
|
||||||
energy_regen = 25.0
|
action_cooldown = 1.5
|
||||||
energy_cost = 20.0
|
max_energy = 50.0
|
||||||
|
energy_regen = 50.0
|
||||||
|
energy_cost = 50.0
|
||||||
|
|
||||||
[node name="Sprite3D" parent="." index="5"]
|
[node name="Sprite3D" parent="." index="5"]
|
||||||
texture = ExtResource("5_2rqsg")
|
texture = ExtResource("5_2rqsg")
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ enum TYPE { NONE, PIERRE, ALINE, MAXENCE, VICTORIA, EVAN, ALEX, GERALDINE }
|
||||||
@export var price : int
|
@export var price : int
|
||||||
|
|
||||||
@export_group("Attack")
|
@export_group("Attack")
|
||||||
@export var projectile : ProjectileResource
|
@export var damage : int
|
||||||
|
@export var projectileScene : PackedScene
|
||||||
@export var towerRange : Shape3D
|
@export var towerRange : Shape3D
|
||||||
@export var action_cooldown : float = 0.3 :
|
@export var action_cooldown : float = 0.3 :
|
||||||
set(value):
|
set(value):
|
||||||
|
|
@ -106,6 +107,8 @@ func shoot() -> void:
|
||||||
return
|
return
|
||||||
|
|
||||||
energy -= energy_cost
|
energy -= energy_cost
|
||||||
|
var projectile : Projectile = projectileScene.instantiate()
|
||||||
|
projectile.amount = damage
|
||||||
projectile.shoot(target, $Aim.global_position)
|
projectile.shoot(target, $Aim.global_position)
|
||||||
$AttackCooldown.start(action_cooldown)
|
$AttackCooldown.start(action_cooldown)
|
||||||
|
|
||||||
|
|
@ -134,6 +137,7 @@ func build() -> bool:
|
||||||
sprite.modulate = "ffffffff"
|
sprite.modulate = "ffffffff"
|
||||||
$EnergyBar3D.visible = true
|
$EnergyBar3D.visible = true
|
||||||
$PriceTag.visible = false
|
$PriceTag.visible = false
|
||||||
|
energyBar.max_value = max_energy
|
||||||
state = STATE.ACTION
|
state = STATE.ACTION
|
||||||
in_action()
|
in_action()
|
||||||
changed.emit()
|
changed.emit()
|
||||||
|
|
|
||||||
|
|
@ -52,13 +52,11 @@ func _process(_delta: float) -> void:
|
||||||
if Input.is_action_just_pressed("rest"):
|
if Input.is_action_just_pressed("rest"):
|
||||||
if tower:
|
if tower:
|
||||||
moveTower(tower, Vector3.INF)
|
moveTower(tower, Vector3.INF)
|
||||||
|
if tower != selected_tower:
|
||||||
|
EventBus.tower_selected.emit(tower.type)
|
||||||
else:
|
else:
|
||||||
EventBus.tower_selected.emit(Tower.TYPE.NONE)
|
EventBus.tower_selected.emit(Tower.TYPE.NONE)
|
||||||
|
|
||||||
if Input.is_action_just_pressed("test"):
|
|
||||||
if tower:
|
|
||||||
tower.disable(2)
|
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
if event is InputEventKey:
|
if event is InputEventKey:
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ func onTowerChange() -> void:
|
||||||
onEnergyChange()
|
onEnergyChange()
|
||||||
%TowerIcon.texture = tower.icone
|
%TowerIcon.texture = tower.icone
|
||||||
%TowerName.text = tower.tower_name
|
%TowerName.text = tower.tower_name
|
||||||
%TowerDamage.text = "Dmg : %d" % tower.projectile.damage
|
%TowerDamage.text = "Dmg : %d" % tower.damage
|
||||||
%TowerCooldown.text = "cooldown : %.1f" % tower.action_cooldown
|
%TowerCooldown.text = "cooldown : %.1f" % tower.action_cooldown
|
||||||
# TODO Check for better UI to display it
|
# TODO Check for better UI to display it
|
||||||
#%TowerBio.text = tower.bio
|
#%TowerBio.text = tower.bio
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ enum TYPE {
|
||||||
ENERGY_REGEN,
|
ENERGY_REGEN,
|
||||||
ENERGY_COST,
|
ENERGY_COST,
|
||||||
DAMAGE,
|
DAMAGE,
|
||||||
AOE_INCREASE,
|
AOE_INCREASE, ## NOT WORKING
|
||||||
COOLDOWN,
|
COOLDOWN,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -23,8 +23,8 @@ func upgrade(tower: Tower = null) -> bool:
|
||||||
TYPE.MAX_ENERGY: upgradeProperty(tower, "max_energy")
|
TYPE.MAX_ENERGY: upgradeProperty(tower, "max_energy")
|
||||||
TYPE.ENERGY_REGEN: upgradeProperty(tower, "energy_regen")
|
TYPE.ENERGY_REGEN: upgradeProperty(tower, "energy_regen")
|
||||||
TYPE.ENERGY_COST: upgradeProperty(tower, "energy_cost")
|
TYPE.ENERGY_COST: upgradeProperty(tower, "energy_cost")
|
||||||
TYPE.DAMAGE: upgradeProperty(tower.projectile, "damage")
|
TYPE.DAMAGE: upgradeProperty(tower, "damage")
|
||||||
TYPE.AOE_INCREASE: upgradeProperty(tower.projectile.damageArea, "radius")
|
#TYPE.AOE_INCREASE: upgradeProperty(tower.projectile.damageArea, "radius")
|
||||||
TYPE.COOLDOWN: upgradeProperty(tower, "action_cooldown")
|
TYPE.COOLDOWN: upgradeProperty(tower, "action_cooldown")
|
||||||
|
|
||||||
upgradeUpgrade()
|
upgradeUpgrade()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue