Advertisement
Guest User

GAMEBOX 1: SOURCE CODE tvboy.gd

a guest
Sep 22nd, 2019
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. extends Node2D
  2.  
  3. var scare_point = Vector2(0, 0)
  4. var scared = false
  5.  
  6. var is_tv = false
  7.  
  8. var SPEED = 100
  9.  
  10. func _ready():
  11.     randomize()
  12.     add_to_group("tvboys")
  13.  
  14. func _process(delta):
  15.     if scared and not(is_tv):
  16.         var movement_vector = Vector2(SPEED*delta, 0).rotated(position.angle_to_point(scare_point))
  17.         position += movement_vector
  18.  
  19. func run_from(new_scare_point):
  20.     scare_point = new_scare_point
  21.     scared = true
  22.  
  23. func _on_Button_pressed():
  24.     $AnimatedSprite.animation = "tv"
  25.     modulate = Color(randf(), randf(), randf(), 1)
  26.     is_tv = true
  27.     for tvboy in get_tree().get_nodes_in_group("tvboys"):
  28.         if not(tvboy.is_tv):
  29.             tvboy.run_from(position)
  30.  
  31. func _on_Timer_timeout():
  32.     pass # Replace with function body.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement