score.gd 487 B

123456789101112131415161718192021222324
  1. extends Label
  2. onready var pause_camera=get_tree().get_root().get_node("scene/main_screen/main_vp/scene/pause_camera")
  3. var score=0.0
  4. export (int) var lastsc=0
  5. func _ready():
  6. self.set_text("00000")
  7. pass
  8. func _process(delta):
  9. if(!get_tree().paused):
  10. if(pause_camera.SPEED<=0.05):
  11. score=0
  12. score+=delta
  13. if(lastsc!=floor(score)):
  14. lastsc=floor(score)
  15. var texxt=str(lastsc)
  16. var ext=""
  17. for a in range(max(5-texxt.length(),0)):
  18. ext+="0"
  19. self.set_text(ext+texxt)