Step by step - Creating your first script
This commit is contained in:
parent
7c9e657d7a
commit
8235939bf3
2 changed files with 20 additions and 0 deletions
9
scenes/icon.tscn
Normal file
9
scenes/icon.tscn
Normal file
|
@ -0,0 +1,9 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://6ws803s4tnhy"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bhxwkp0e2me1u" path="res://icon.png" id="1_6td5b"]
|
||||
[ext_resource type="Script" path="res://scripts/icon.gd" id="2_hmv6m"]
|
||||
|
||||
[node name="Icon" type="Sprite2D"]
|
||||
position = Vector2(577, 294)
|
||||
texture = ExtResource("1_6td5b")
|
||||
script = ExtResource("2_hmv6m")
|
11
scripts/icon.gd
Normal file
11
scripts/icon.gd
Normal file
|
@ -0,0 +1,11 @@
|
|||
extends Sprite2D
|
||||
|
||||
var speed = 400
|
||||
var angular_speed = PI
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
rotation += angular_speed * delta
|
||||
|
||||
var velocity = Vector2.UP.rotated(rotation) * speed
|
||||
|
||||
position += velocity * delta
|
Loading…
Reference in a new issue