Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Node2D
- var scare_point = Vector2(0, 0)
- var scared = false
- var is_tv = false
- var SPEED = 100
- func _ready():
- randomize()
- add_to_group("tvboys")
- func _process(delta):
- if scared and not(is_tv):
- var movement_vector = Vector2(SPEED*delta, 0).rotated(position.angle_to_point(scare_point))
- position += movement_vector
- func run_from(new_scare_point):
- scare_point = new_scare_point
- scared = true
- func _on_Button_pressed():
- $AnimatedSprite.animation = "tv"
- modulate = Color(randf(), randf(), randf(), 1)
- is_tv = true
- for tvboy in get_tree().get_nodes_in_group("tvboys"):
- if not(tvboy.is_tv):
- tvboy.run_from(position)
- func _on_Timer_timeout():
- pass # Replace with function body.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement