1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
extends Polygon2D # Declare member variables here. Examples: # var a = 2 # var b = "text" var progress = 1.0 var deltaValue = 0.001 # Called when the node enters the scene tree for the first time. func _ready(): setIt(progress) func setIt(percent): var arr = [] var maxi = 128 var full = ((PI+PI)) var left = percent < 0.5 var fillPercent if left: fillPercent = (percent * 2.0) else: fillPercent = 1.0 - ((percent - 0.5) * 2.0) for i in range(0, maxi): var xOff if (left and i > maxi/2) or (not left and i < maxi/2): xOff = 1.0 else: xOff = (fillPercent*2)-1.0 var x = (sin(full*(float(i)/float(maxi)))*1100)*xOff var y = cos(full*(float(i)/float(maxi)))*1090 arr.append(Vector2(x + 10,y + 10)) polygon = (PoolVector2Array(arr)) func _physics_process(delta): progress += deltaValue if progress >= 1.0: progress = deltaValue setIt(progress) #for i in range(0, len(polygon)): # polygon[i].x += 0.00001*i