Finishing scripting_first_script section
This commit is contained in:
parent
553cfad8ae
commit
6a7e1d0066
2 changed files with 20 additions and 0 deletions
11
scripting_first_script/Sprite2D.gd
Normal file
11
scripting_first_script/Sprite2D.gd
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
extends Sprite2D
|
||||||
|
|
||||||
|
var speed = 400
|
||||||
|
var angular_speed = PI
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
rotation += angular_speed * delta
|
||||||
|
|
||||||
|
var velocity = Vector2.UP.rotated(rotation) * speed
|
||||||
|
|
||||||
|
position += velocity * delta
|
9
scripting_first_script/sprite_2d.tscn
Normal file
9
scripting_first_script/sprite_2d.tscn
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://bxxuj5sw4p1oy"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://d1dh0isrpxkpi" path="res://icon.svg" id="1_trp2n"]
|
||||||
|
[ext_resource type="Script" path="res://Sprite2D.gd" id="2_jok8k"]
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D"]
|
||||||
|
position = Vector2(682, 358)
|
||||||
|
texture = ExtResource("1_trp2n")
|
||||||
|
script = ExtResource("2_jok8k")
|
Loading…
Reference in a new issue