Merge branch 'main' of https://github.com/MarcEricMartel/Game-Jam-A23
This commit is contained in:
commit
cadd195f3a
4
Scenes/Spawnables/AIs/ai_bat.gd
Normal file
4
Scenes/Spawnables/AIs/ai_bat.gd
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
extends AITemplate
|
||||||
|
|
||||||
|
func getDirection(position, enemyPosition) -> Vector2:
|
||||||
|
return Vector2.ZERO
|
5
Scenes/Spawnables/AIs/ai_template.gd
Normal file
5
Scenes/Spawnables/AIs/ai_template.gd
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class_name AITemplate
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
func run(position, enemyPosition) -> Vector2:
|
||||||
|
return Vector2.ZERO
|
14
Scenes/Spawnables/bat_spawnable.tscn
Normal file
14
Scenes/Spawnables/bat_spawnable.tscn
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://brnx3xyyd0e71"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://kkfxguj0lr5a" path="res://Scenes/Spawnables/template_spawnable.tscn" id="1_verf7"]
|
||||||
|
[ext_resource type="Script" path="res://Scenes/Spawnables/AIs/ai_bat.gd" id="2_x3ldf"]
|
||||||
|
|
||||||
|
[node name="BatSpawnable" instance=ExtResource("1_verf7")]
|
||||||
|
maxHp = 10
|
||||||
|
attackSpeed = 10.0
|
||||||
|
speed = 100.0
|
||||||
|
damage = 1
|
||||||
|
priority = 1
|
||||||
|
|
||||||
|
[node name="AI" parent="." index="3"]
|
||||||
|
script = ExtResource("2_x3ldf")
|
66
Scenes/Spawnables/template_spawnable.gd
Normal file
66
Scenes/Spawnables/template_spawnable.gd
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
class_name TemplateSpawnable
|
||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
@export var maxHp : int = 0
|
||||||
|
@export var attackSpeed : float = 0
|
||||||
|
@export var speed : float = 0
|
||||||
|
@export var damage : int = 0
|
||||||
|
@export var priority : int = 0
|
||||||
|
|
||||||
|
@onready var ai : Node = $AI
|
||||||
|
@onready var animatedSprite : AnimatedSprite2D = $AnimatedSprite2D
|
||||||
|
|
||||||
|
var isAlive : bool = true
|
||||||
|
var direction : Vector2 = Vector2.ZERO
|
||||||
|
var enemy : CharacterBody2D = null
|
||||||
|
|
||||||
|
var currentHp : int = 0
|
||||||
|
var cooldown : float = 0
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
enemy = get_node("../Enemy")
|
||||||
|
currentHp = maxHp
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
if !isAlive:
|
||||||
|
return
|
||||||
|
|
||||||
|
if enemy != null:
|
||||||
|
direction = ai.getDirection(position, enemy.position)
|
||||||
|
else:
|
||||||
|
direction = Vector2.ZERO
|
||||||
|
|
||||||
|
velocity = direction * speed * delta
|
||||||
|
move_and_slide()
|
||||||
|
|
||||||
|
func attack(target):
|
||||||
|
animatedSprite.play("attack")
|
||||||
|
animatedSprite.connect("animation_finished", endAttack(target))
|
||||||
|
|
||||||
|
func endAttack(target):
|
||||||
|
target.receive_damage(damage)
|
||||||
|
animatedSprite.play("default")
|
||||||
|
|
||||||
|
func receive_damage(dmg):
|
||||||
|
if !isAlive:
|
||||||
|
return
|
||||||
|
|
||||||
|
if currentHp - dmg <= 0:
|
||||||
|
currentHp = 0
|
||||||
|
die()
|
||||||
|
else :
|
||||||
|
currentHp -= dmg
|
||||||
|
|
||||||
|
func die():
|
||||||
|
isAlive = false
|
||||||
|
animatedSprite.play("death")
|
||||||
|
animatedSprite.connect("animation_finished", self.fadeOut())
|
||||||
|
|
||||||
|
func fadeOut():
|
||||||
|
var tween = Tween.new()
|
||||||
|
add_child(tween)
|
||||||
|
tween.tween_property(animatedSprite, "modulate", Color(0,0,0,0), 1)
|
||||||
|
tween.tween_callback(clean())
|
||||||
|
|
||||||
|
func clean():
|
||||||
|
queue_free()
|
@ -1,119 +1,120 @@
|
|||||||
[gd_scene load_steps=33 format=3 uid="uid://kkfxguj0lr5a"]
|
[gd_scene load_steps=36 format=3 uid="uid://kkfxguj0lr5a"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://ddvr5ltbo8ome" path="res://Assets/Bat/noBKG_BatFlight_strip.png" id="1_0e1hj"]
|
[ext_resource type="Script" path="res://Scenes/Spawnables/template_spawnable.gd" id="1_rkej7"]
|
||||||
[ext_resource type="Texture2D" uid="uid://f60ndepwmpj2" path="res://Assets/Bat/noBKG_BatAttack_strip.png" id="1_lwas7"]
|
[ext_resource type="Texture2D" uid="uid://f60ndepwmpj2" path="res://Assets/Bat/noBKG_BatAttack_strip.png" id="2_7ayi7"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bd74k1s6qdx2r" path="res://Assets/Bat/noBKG_BatDeath_strip.png" id="2_xdsxs"]
|
[ext_resource type="Texture2D" uid="uid://bd74k1s6qdx2r" path="res://Assets/Bat/noBKG_BatDeath_strip.png" id="3_jipj7"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://ddvr5ltbo8ome" path="res://Assets/Bat/noBKG_BatFlight_strip.png" id="4_u36ok"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_y0lcs"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_y0lcs"]
|
||||||
atlas = ExtResource("1_lwas7")
|
atlas = ExtResource("2_7ayi7")
|
||||||
region = Rect2(0, 0, 64, 64)
|
region = Rect2(0, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3te70"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_3te70"]
|
||||||
atlas = ExtResource("1_lwas7")
|
atlas = ExtResource("2_7ayi7")
|
||||||
region = Rect2(64, 0, 64, 64)
|
region = Rect2(64, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8bbsy"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_8bbsy"]
|
||||||
atlas = ExtResource("1_lwas7")
|
atlas = ExtResource("2_7ayi7")
|
||||||
region = Rect2(128, 0, 64, 64)
|
region = Rect2(128, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_u466m"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_u466m"]
|
||||||
atlas = ExtResource("1_lwas7")
|
atlas = ExtResource("2_7ayi7")
|
||||||
region = Rect2(192, 0, 64, 64)
|
region = Rect2(192, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_mbryr"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_mbryr"]
|
||||||
atlas = ExtResource("1_lwas7")
|
atlas = ExtResource("2_7ayi7")
|
||||||
region = Rect2(256, 0, 64, 64)
|
region = Rect2(256, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qktvn"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_qktvn"]
|
||||||
atlas = ExtResource("1_lwas7")
|
atlas = ExtResource("2_7ayi7")
|
||||||
region = Rect2(320, 0, 64, 64)
|
region = Rect2(320, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_cvyc6"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_cvyc6"]
|
||||||
atlas = ExtResource("1_lwas7")
|
atlas = ExtResource("2_7ayi7")
|
||||||
region = Rect2(384, 0, 64, 64)
|
region = Rect2(384, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7q0ye"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7q0ye"]
|
||||||
atlas = ExtResource("1_lwas7")
|
atlas = ExtResource("2_7ayi7")
|
||||||
region = Rect2(448, 0, 64, 64)
|
region = Rect2(448, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xtaoc"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_xtaoc"]
|
||||||
atlas = ExtResource("1_lwas7")
|
atlas = ExtResource("2_7ayi7")
|
||||||
region = Rect2(512, 0, 64, 64)
|
region = Rect2(512, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_bxitd"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_bxitd"]
|
||||||
atlas = ExtResource("1_lwas7")
|
atlas = ExtResource("2_7ayi7")
|
||||||
region = Rect2(576, 0, 64, 64)
|
region = Rect2(576, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_fceiv"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_fceiv"]
|
||||||
atlas = ExtResource("2_xdsxs")
|
atlas = ExtResource("3_jipj7")
|
||||||
region = Rect2(0, 0, 64, 64)
|
region = Rect2(0, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_j2d0r"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_j2d0r"]
|
||||||
atlas = ExtResource("2_xdsxs")
|
atlas = ExtResource("3_jipj7")
|
||||||
region = Rect2(64, 0, 64, 64)
|
region = Rect2(64, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_bbp3t"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_bbp3t"]
|
||||||
atlas = ExtResource("2_xdsxs")
|
atlas = ExtResource("3_jipj7")
|
||||||
region = Rect2(128, 0, 64, 64)
|
region = Rect2(128, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xfqr4"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_xfqr4"]
|
||||||
atlas = ExtResource("2_xdsxs")
|
atlas = ExtResource("3_jipj7")
|
||||||
region = Rect2(192, 0, 64, 64)
|
region = Rect2(192, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_s2tpc"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_s2tpc"]
|
||||||
atlas = ExtResource("2_xdsxs")
|
atlas = ExtResource("3_jipj7")
|
||||||
region = Rect2(256, 0, 64, 64)
|
region = Rect2(256, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ipc4l"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ipc4l"]
|
||||||
atlas = ExtResource("2_xdsxs")
|
atlas = ExtResource("3_jipj7")
|
||||||
region = Rect2(320, 0, 64, 64)
|
region = Rect2(320, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4fipm"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_4fipm"]
|
||||||
atlas = ExtResource("2_xdsxs")
|
atlas = ExtResource("3_jipj7")
|
||||||
region = Rect2(384, 0, 64, 64)
|
region = Rect2(384, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xnm62"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_xnm62"]
|
||||||
atlas = ExtResource("2_xdsxs")
|
atlas = ExtResource("3_jipj7")
|
||||||
region = Rect2(448, 0, 64, 64)
|
region = Rect2(448, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_itxso"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_itxso"]
|
||||||
atlas = ExtResource("2_xdsxs")
|
atlas = ExtResource("3_jipj7")
|
||||||
region = Rect2(512, 0, 64, 64)
|
region = Rect2(512, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7bunh"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7bunh"]
|
||||||
atlas = ExtResource("2_xdsxs")
|
atlas = ExtResource("3_jipj7")
|
||||||
region = Rect2(576, 0, 64, 64)
|
region = Rect2(576, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2gneh"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_2gneh"]
|
||||||
atlas = ExtResource("1_0e1hj")
|
atlas = ExtResource("4_u36ok")
|
||||||
region = Rect2(0, 0, 64, 64)
|
region = Rect2(0, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0edov"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_0edov"]
|
||||||
atlas = ExtResource("1_0e1hj")
|
atlas = ExtResource("4_u36ok")
|
||||||
region = Rect2(64, 0, 64, 64)
|
region = Rect2(64, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_312tg"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_312tg"]
|
||||||
atlas = ExtResource("1_0e1hj")
|
atlas = ExtResource("4_u36ok")
|
||||||
region = Rect2(128, 0, 64, 64)
|
region = Rect2(128, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_5y1ay"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_5y1ay"]
|
||||||
atlas = ExtResource("1_0e1hj")
|
atlas = ExtResource("4_u36ok")
|
||||||
region = Rect2(192, 0, 64, 64)
|
region = Rect2(192, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_igb7j"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_igb7j"]
|
||||||
atlas = ExtResource("1_0e1hj")
|
atlas = ExtResource("4_u36ok")
|
||||||
region = Rect2(256, 0, 64, 64)
|
region = Rect2(256, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ebjmq"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ebjmq"]
|
||||||
atlas = ExtResource("1_0e1hj")
|
atlas = ExtResource("4_u36ok")
|
||||||
region = Rect2(320, 0, 64, 64)
|
region = Rect2(320, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hgxj4"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_hgxj4"]
|
||||||
atlas = ExtResource("1_0e1hj")
|
atlas = ExtResource("4_u36ok")
|
||||||
region = Rect2(384, 0, 64, 64)
|
region = Rect2(384, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3ywov"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_3ywov"]
|
||||||
atlas = ExtResource("1_0e1hj")
|
atlas = ExtResource("4_u36ok")
|
||||||
region = Rect2(448, 0, 64, 64)
|
region = Rect2(448, 0, 64, 64)
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_k6v1d"]
|
[sub_resource type="SpriteFrames" id="SpriteFrames_k6v1d"]
|
||||||
@ -149,7 +150,7 @@ animations = [{
|
|||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_bxitd")
|
"texture": SubResource("AtlasTexture_bxitd")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": false,
|
||||||
"name": &"attack",
|
"name": &"attack",
|
||||||
"speed": 12.0
|
"speed": 12.0
|
||||||
}, {
|
}, {
|
||||||
@ -184,7 +185,7 @@ animations = [{
|
|||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_7bunh")
|
"texture": SubResource("AtlasTexture_7bunh")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": false,
|
||||||
"name": &"death",
|
"name": &"death",
|
||||||
"speed": 12.0
|
"speed": 12.0
|
||||||
}, {
|
}, {
|
||||||
@ -218,10 +219,31 @@ animations = [{
|
|||||||
"speed": 12.0
|
"speed": 12.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
[node name="BaseSpawnable" type="CharacterBody2D"]
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_5aviq"]
|
||||||
|
radius = 6.0
|
||||||
|
height = 14.0
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_2l8j3"]
|
||||||
|
radius = 7.0
|
||||||
|
height = 22.0
|
||||||
|
|
||||||
|
[node name="TemplateSpawnable" type="CharacterBody2D"]
|
||||||
|
collision_layer = 6
|
||||||
|
collision_mask = 6
|
||||||
|
script = ExtResource("1_rkej7")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
sprite_frames = SubResource("SpriteFrames_k6v1d")
|
sprite_frames = SubResource("SpriteFrames_k6v1d")
|
||||||
frame_progress = 0.46295
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="BodyCollision" type="CollisionShape2D" parent="."]
|
||||||
|
rotation = 1.5708
|
||||||
|
shape = SubResource("CapsuleShape2D_5aviq")
|
||||||
|
|
||||||
|
[node name="Attack" type="Area2D" parent="."]
|
||||||
|
|
||||||
|
[node name="AttackCollision" type="CollisionShape2D" parent="Attack"]
|
||||||
|
rotation = 1.5708
|
||||||
|
shape = SubResource("CapsuleShape2D_2l8j3")
|
||||||
|
debug_color = Color(0.803922, 0, 0.180392, 0.419608)
|
||||||
|
|
||||||
|
[node name="AI" type="Node" parent="."]
|
@ -380,7 +380,7 @@ script = ExtResource("1_xj62t")
|
|||||||
sprite_frames = SubResource("SpriteFrames_dqf8u")
|
sprite_frames = SubResource("SpriteFrames_dqf8u")
|
||||||
animation = &"Idle"
|
animation = &"Idle"
|
||||||
autoplay = "Idle"
|
autoplay = "Idle"
|
||||||
frame_progress = 0.93659
|
frame_progress = 0.487368
|
||||||
flip_h = true
|
flip_h = true
|
||||||
|
|
||||||
[node name="Atk_cooldown" type="Timer" parent="."]
|
[node name="Atk_cooldown" type="Timer" parent="."]
|
||||||
@ -406,6 +406,8 @@ scale_amount_min = 0.01
|
|||||||
scale_amount_max = 0.01
|
scale_amount_max = 0.01
|
||||||
color = Color(1, 1, 1, 0.423529)
|
color = Color(1, 1, 1, 0.423529)
|
||||||
|
|
||||||
|
[node name="LvlUpSnd" type="AudioStreamPlayer2D" parent="."]
|
||||||
|
|
||||||
[node name="CharacterCollision" type="CollisionShape2D" parent="."]
|
[node name="CharacterCollision" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("CapsuleShape2D_p2hkm")
|
shape = SubResource("CapsuleShape2D_p2hkm")
|
||||||
|
|
||||||
|
@ -9,12 +9,14 @@ extends CharacterBody2D
|
|||||||
@export var level: int = 1
|
@export var level: int = 1
|
||||||
@export var hp: int = 100
|
@export var hp: int = 100
|
||||||
@export var maxhp: int = 100
|
@export var maxhp: int = 100
|
||||||
|
@export var maxvel: float = 2
|
||||||
@export var experience: int = 0
|
@export var experience: int = 0
|
||||||
@export var state: String = "Idle"
|
@export var state: String = "Idle"
|
||||||
|
|
||||||
@onready var anim: Node = get_node("Sprite")
|
@onready var anim: Node = get_node("Sprite")
|
||||||
@onready var cooldown: Node = get_node("Atk_cooldown")
|
@onready var cooldown: Node = get_node("Atk_cooldown")
|
||||||
@onready var lvlanim: Node = get_node("LvlUp")
|
@onready var lvlanim: Node = get_node("LvlUp")
|
||||||
|
@onready var lvlsnd: Node = get_node("LvlUpSnd")
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
@ -31,12 +33,25 @@ func _process(delta):
|
|||||||
is_facing_left = velocity.x >= 0
|
is_facing_left = velocity.x >= 0
|
||||||
|
|
||||||
# AI STUFF
|
# AI STUFF
|
||||||
|
#velocity = processAI(objects,velocity,delta)
|
||||||
|
|
||||||
velocity.x += delta
|
velocity.x += delta
|
||||||
velocity.y += delta
|
velocity.y += delta
|
||||||
|
|
||||||
|
if abs(velocity.x + velocity.y) > maxvel:
|
||||||
|
velocity.x *= maxvel / velocity.x
|
||||||
|
velocity.y *= maxvel / velocity.y
|
||||||
|
|
||||||
position += velocity
|
position += velocity
|
||||||
|
|
||||||
|
|
||||||
|
func processAI(objs, delta):
|
||||||
|
var vec: Vector2 = Vector2(0,0)
|
||||||
|
for obj in objs:
|
||||||
|
vec += obj.vecpos * obj.weight * (1 / (position - obj.vecpos)) * delta
|
||||||
|
return vec.normalized()
|
||||||
|
|
||||||
|
|
||||||
func attack():
|
func attack():
|
||||||
is_attacking = true
|
is_attacking = true
|
||||||
if (level > 1):
|
if (level > 1):
|
||||||
@ -86,6 +101,7 @@ func receive_exp(x):
|
|||||||
func setLevel(lvl):
|
func setLevel(lvl):
|
||||||
level = lvl
|
level = lvl
|
||||||
lvlanim.restart()
|
lvlanim.restart()
|
||||||
|
lvlsnd.play()
|
||||||
|
|
||||||
if level > 2:
|
if level > 2:
|
||||||
cooldown.wait_time = 0.5
|
cooldown.wait_time = 0.5
|
||||||
@ -99,3 +115,4 @@ func _on_sprite_animation_looped():
|
|||||||
if is_attacking:
|
if is_attacking:
|
||||||
stop_attack()
|
stop_attack()
|
||||||
is_dying = false
|
is_dying = false
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user