ajout mod poulpe
This commit is contained in:
parent
4bab72b7d4
commit
2ae314b374
16 changed files with 296 additions and 7 deletions
|
@ -7,14 +7,29 @@ var player_position = Vector2.ZERO
|
|||
var target_position = Vector2.ZERO
|
||||
|
||||
var move_timer = 2
|
||||
var next_degat = 1
|
||||
|
||||
var vie = 4
|
||||
|
||||
func take_damage(dmg : int) :
|
||||
vie -= dmg
|
||||
if vie <= 0:
|
||||
queue_free()
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
player_position = player.position
|
||||
target_position = (player_position - position).normalized()
|
||||
move_and_slide()
|
||||
next_degat -= delta
|
||||
|
||||
for i in get_slide_collision_count():
|
||||
var collision = get_slide_collision(i)
|
||||
if collision.get_collider_shape().get_instance_id() == player.get_child(1).get_instance_id():
|
||||
if next_degat <= 0:
|
||||
player.take_damage(2)
|
||||
next_degat = 1
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
var direction : Vector2
|
||||
|
@ -27,3 +42,9 @@ func _process(delta: float) -> void:
|
|||
$AnimatedSprite2D.play("Generic")
|
||||
|
||||
velocity = direction * SPEED
|
||||
|
||||
|
||||
func Collision(body: Node2D) -> void:
|
||||
print(body)
|
||||
if body.is_in_group("Player") :
|
||||
body.take_damage(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue