"eh bo derek"
This commit is contained in:
parent
4de4f43753
commit
98e9404435
@ -14,7 +14,7 @@
|
|||||||
position = Vector2(441, 312)
|
position = Vector2(441, 312)
|
||||||
|
|
||||||
[node name="BatSpawnable" parent="." instance=ExtResource("3_a1ucf")]
|
[node name="BatSpawnable" parent="." instance=ExtResource("3_a1ucf")]
|
||||||
position = Vector2(248, 225)
|
position = Vector2(62, 122)
|
||||||
|
|
||||||
[node name="BatSpawnable2" parent="." instance=ExtResource("3_a1ucf")]
|
[node name="BatSpawnable2" parent="." instance=ExtResource("3_a1ucf")]
|
||||||
position = Vector2(644, 251)
|
position = Vector2(644, 251)
|
||||||
|
@ -90,6 +90,7 @@ func die():
|
|||||||
animatedSprite.play("death")
|
animatedSprite.play("death")
|
||||||
animatedSprite.disconnect("animation_finished", endAttack)
|
animatedSprite.disconnect("animation_finished", endAttack)
|
||||||
animatedSprite.connect("animation_finished", fadeOut)
|
animatedSprite.connect("animation_finished", fadeOut)
|
||||||
|
enemy.remove_foe(self)
|
||||||
|
|
||||||
func fadeOut():
|
func fadeOut():
|
||||||
var tween = get_tree().create_tween()
|
var tween = get_tree().create_tween()
|
||||||
|
@ -44,11 +44,13 @@ func _ready():
|
|||||||
atk1r.set_disabled(true)
|
atk1r.set_disabled(true)
|
||||||
atk2l.set_disabled(true)
|
atk2l.set_disabled(true)
|
||||||
atk2r.set_disabled(true)
|
atk2r.set_disabled(true)
|
||||||
|
list.append($"../BatSpawnable")
|
||||||
|
list.append($"../BatSpawnable2")
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if abs(velocity.x) < 0.1 && abs(velocity.y) < 0.1 && !is_attacking:
|
if abs(velocity.x) < 0.2 && abs(velocity.y) < 0.2 && !is_attacking:
|
||||||
setAnimState("Idle")
|
setAnimState("Idle")
|
||||||
elif !is_attacking:
|
elif !is_attacking:
|
||||||
setAnimState("Run")
|
setAnimState("Run")
|
||||||
@ -57,32 +59,33 @@ func _process(delta):
|
|||||||
is_facing_left = velocity.x > 0 && !(velocity.x < 0)
|
is_facing_left = velocity.x > 0 && !(velocity.x < 0)
|
||||||
|
|
||||||
# AI STUFF
|
# AI STUFF
|
||||||
#velocity += processAI(list,delta)
|
velocity += processAI(list) * delta
|
||||||
var x = 0
|
#var x = 0
|
||||||
var y = 0
|
#var y = 0
|
||||||
|
|
||||||
if Input.is_action_pressed("ui_left"):
|
#if Input.is_action_pressed("ui_left"):
|
||||||
|
# # Move as long as the key/button is pressed.
|
||||||
|
# x -= delta * 50
|
||||||
|
#elif Input.is_action_pressed("ui_right"):
|
||||||
|
# # Move as long as the key/button is pressed.
|
||||||
|
# x += delta * 50
|
||||||
|
#else:
|
||||||
|
# velocity.x *= 0.8
|
||||||
|
#if Input.is_action_pressed("ui_up"):
|
||||||
# Move as long as the key/button is pressed.
|
# Move as long as the key/button is pressed.
|
||||||
x -= delta * 50
|
# y -= delta * 50
|
||||||
elif Input.is_action_pressed("ui_right"):
|
#elif Input.is_action_pressed("ui_down"):
|
||||||
# Move as long as the key/button is pressed.
|
# Move as long as the key/button is pressed.
|
||||||
x += delta * 50
|
# y += delta * 50
|
||||||
else:
|
#else:
|
||||||
velocity.x *= 0.8
|
# velocity.y *= 0.8
|
||||||
if Input.is_action_pressed("ui_up"):
|
while velocity.length() > 100:
|
||||||
# Move as long as the key/button is pressed.
|
velocity.x *= 0.99
|
||||||
y -= delta * 50
|
velocity.y *= 0.99
|
||||||
elif Input.is_action_pressed("ui_down"):
|
velocity.x *= 0.99
|
||||||
# Move as long as the key/button is pressed.
|
velocity.y *= 0.99
|
||||||
y += delta * 50
|
#velocity.x += x
|
||||||
else:
|
#velocity.y += y
|
||||||
velocity.y *= 0.8
|
|
||||||
|
|
||||||
velocity.x += x
|
|
||||||
velocity.y += y
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if !hitanim.is_emitting():
|
if !hitanim.is_emitting():
|
||||||
anim.modulate.a = 1
|
anim.modulate.a = 1
|
||||||
@ -90,11 +93,25 @@ func _process(delta):
|
|||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
|
||||||
|
|
||||||
func processAI(objs, delta):
|
func processAI(objs):
|
||||||
var vec: Vector2 = Vector2(0,0)
|
var vec: Vector2 = Vector2(0,0)
|
||||||
|
var weight: int = 0
|
||||||
for obj in objs:
|
for obj in objs:
|
||||||
vec += obj.vecpos * obj.weight * (1 / (position - obj.vecpos)) * delta
|
if position.distance_to(obj.position) > 10:
|
||||||
return vec.normalized()
|
weight = abs(obj.priority) * position.distance_to(obj.position)
|
||||||
|
vec += weight * position.direction_to(obj.position)
|
||||||
|
else:
|
||||||
|
weight = obj.priority * position.distance_to(obj.position) * (maxhp / hp) * 100
|
||||||
|
vec += weight * -position.direction_to(obj.position)
|
||||||
|
|
||||||
|
if vec.length() < 5 && objs.size() > 1:
|
||||||
|
vec.y *= 3
|
||||||
|
|
||||||
|
if velocity.length() < 95 && objs.size() > 1:
|
||||||
|
vec.y += 10
|
||||||
|
vec.x -= vec.x * .2
|
||||||
|
|
||||||
|
return vec.normalized() * 100
|
||||||
|
|
||||||
|
|
||||||
func attack():
|
func attack():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user