Get Map Gernation in #17
3 changed files with 5 additions and 14 deletions
|
@ -114,9 +114,8 @@ _data = {
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_nil6g"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_nil6g"]
|
||||||
radius = 11.0
|
radius = 11.0
|
||||||
|
|
||||||
[node name="Bunny" type="Area2D" node_paths=PackedStringArray("animation_player", "agent")]
|
[node name="Bunny" type="CharacterBody2D" node_paths=PackedStringArray("animation_player", "agent")]
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 0
|
|
||||||
script = ExtResource("1_1kj2b")
|
script = ExtResource("1_1kj2b")
|
||||||
animation_player = NodePath("BunnyAnimator")
|
animation_player = NodePath("BunnyAnimator")
|
||||||
agent = NodePath("NavigationAgent")
|
agent = NodePath("NavigationAgent")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
extends Node2D
|
extends CharacterBody2D
|
||||||
class_name Bunny
|
class_name Bunny
|
||||||
|
|
||||||
@export var animation_player : AnimationPlayer
|
@export var animation_player : AnimationPlayer
|
||||||
|
@ -59,7 +59,7 @@ func _physics_process(delta):
|
||||||
time_since_got_player = 10.0
|
time_since_got_player = 10.0
|
||||||
time_since_got_move_location = 10.0
|
time_since_got_move_location = 10.0
|
||||||
else:
|
else:
|
||||||
self.translate(move_velocity)
|
move_and_collide(move_velocity)
|
||||||
else:
|
else:
|
||||||
animation_player.stop()
|
animation_player.stop()
|
||||||
time_since_got_player += delta
|
time_since_got_player += delta
|
||||||
|
|
|
@ -28,17 +28,9 @@ func _on_collision(body):
|
||||||
|
|
||||||
if collided_layer & map_collision_layer:
|
if collided_layer & map_collision_layer:
|
||||||
queue_free()
|
queue_free()
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
func _on_area_entered(area):
|
|
||||||
var collided_layer = null;
|
|
||||||
|
|
||||||
if(area.has_method("get_collision_layer")):
|
|
||||||
collided_layer = area.get_collision_layer()
|
|
||||||
|
|
||||||
if collided_layer & bunny_collision_layer:
|
if collided_layer & bunny_collision_layer:
|
||||||
var bunny = area as Bunny
|
var bunny = body as Bunny
|
||||||
bunny.damage(damage)
|
bunny.damage(damage)
|
||||||
queue_free()
|
queue_free()
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Reference in a new issue