代码拉取完成,页面将自动刷新
extends Node2D
export var max_resource = 10.0
var resource
var percentage=0.0
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
max_resource += randi() % int(max_resource) - max_resource/2
resource = max_resource
#print(filename)
pass # Replace with function body.
func _draw():
#print(name, "_draw() called")
draw_circle(Vector2(0,0),8,Color.greenyellow)
draw_arc(Vector2(0,0), 12, -0.5 * PI, -(2 * PI * percentage + 0.5 * PI), 32 * percentage, Color.greenyellow, 4, true)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
percentage = resource / max_resource
#print(str(resource), "/", str(max_resource), "=",str(percentage))
#_draw()
update()
#$Label.text = "food:" + str(resource)
if resource <= 0:
queue_free()
# pass
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。