bullet.gd 365 B

12345678910111213141516171819
  1. extends KinematicBody2D
  2. var motion = Vector2.ZERO
  3. var type = 4
  4. var id = ''
  5. #func _ready():
  6. # print('bullet gen...')
  7. func _physics_process(delta):
  8. var collide = move_and_collide(motion*delta)
  9. if collide:
  10. if collide.collider.is_in_group('enemy'):
  11. collide.collider.damage(-1,id)
  12. print('col enemy')
  13. queue_free()
  14. func _on_Timer_timeout():
  15. queue_free()