|
@@ -1,8 +1,16 @@
|
|
|
extends KinematicBody2D
|
|
|
|
|
|
+var knockback_counter = 25
|
|
|
+var knockback_counter_buff = 0
|
|
|
+
|
|
|
|
|
|
func damage(arg, id):
|
|
|
vida += arg
|
|
|
+ knockback_counter_buff += arg
|
|
|
+ if knockback_counter_buff < 0:
|
|
|
+ state = 'knockback'
|
|
|
+ clock = behaviours[state]
|
|
|
+ knockback_counter_buff = knockback_counter
|
|
|
get_tree().get_nodes_in_group('server')[0]._enemy_dmg(enemy_id)
|
|
|
if vida <= 0:
|
|
|
get_tree().get_nodes_in_group('enemy_authority')[0].death_count(id)
|
|
@@ -80,14 +88,13 @@ func _physics_process(delta):
|
|
|
motion.x = 0
|
|
|
motion.y = 40
|
|
|
'canon':
|
|
|
- if onceacycle:
|
|
|
- sprite_loader('canon',global_position,enemy_id)
|
|
|
- onceacycle = false
|
|
|
+ sprite_loader('canon',global_position,enemy_id)
|
|
|
+ if clock == 30 and onceacycle:
|
|
|
var instancer = load('res://enemie/tankcanonball.tscn').instance()
|
|
|
add_child(instancer)
|
|
|
- instancer.global_position = global_position
|
|
|
- motion.x = 0
|
|
|
- motion.y = 40
|
|
|
+ instancer.global_position = $canonpoint.global_position
|
|
|
+ motion.x = 0
|
|
|
+ motion.y = 40
|
|
|
'die':
|
|
|
sprite_loader('die',global_position,enemy_id)
|
|
|
motion.x = 0
|