1 Star 4 Fork 1

董天泽/细胞大战

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
food.gd 894 Bytes
一键复制 编辑 原始数据 按行查看 历史
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/brodong1205/cell-war.git
git@gitee.com:brodong1205/cell-war.git
brodong1205
cell-war
细胞大战
master

搜索帮助