-
Notifications
You must be signed in to change notification settings - Fork 1
/
scn_next.gd
42 lines (32 loc) · 915 Bytes
/
scn_next.gd
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
39
40
41
42
extends Node2D
# Declare member variables here. Examples:
# var a: int = 2
# var b: String = "text"
class RotateSystem extends Node:
var parent: KinematicBody2D
var sprite: Sprite
func _init(parent, sprite) -> void:
self.parent = parent
self.sprite = sprite
func _process(_delta: float) -> void:
parent.rotate(_delta * PI)
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
QGodot.bind_query(
"KinematicBody2D",
["Sprite"],
RotateSystem,
self
)
for x in 100:
var clone := KinematicBody2D.new()
var sprite := Sprite.new()
clone.name = "Icon%d" % x
sprite.name = "Sprite"
sprite.texture = preload("res://icon.png")
clone.position = Vector2(randi() % 1024, randi() % 600)
clone.add_child(sprite)
add_child(clone)
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta: float) -> void:
# pass