diff options
Diffstat (limited to 'demos/2d/lookat')
-rw-r--r-- | demos/2d/lookat/arrow.png | bin | 2528 -> 0 bytes | |||
-rw-r--r-- | demos/2d/lookat/engine.cfg | 5 | ||||
-rw-r--r-- | demos/2d/lookat/icon.png | bin | 1495 -> 0 bytes | |||
-rw-r--r-- | demos/2d/lookat/lookat.gd | 33 | ||||
-rw-r--r-- | demos/2d/lookat/lookat.tscn | 32 |
5 files changed, 0 insertions, 70 deletions
diff --git a/demos/2d/lookat/arrow.png b/demos/2d/lookat/arrow.png Binary files differdeleted file mode 100644 index 25db91e8d1..0000000000 --- a/demos/2d/lookat/arrow.png +++ /dev/null diff --git a/demos/2d/lookat/engine.cfg b/demos/2d/lookat/engine.cfg deleted file mode 100644 index c37f39386e..0000000000 --- a/demos/2d/lookat/engine.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[application] - -name="Look At Pointer" -main_scene="res://lookat.tscn" -icon="res://icon.png" diff --git a/demos/2d/lookat/icon.png b/demos/2d/lookat/icon.png Binary files differdeleted file mode 100644 index 442cc1799f..0000000000 --- a/demos/2d/lookat/icon.png +++ /dev/null diff --git a/demos/2d/lookat/lookat.gd b/demos/2d/lookat/lookat.gd deleted file mode 100644 index c45c3ad622..0000000000 --- a/demos/2d/lookat/lookat.gd +++ /dev/null @@ -1,33 +0,0 @@ - -extends Sprite - -# Member variables -const MODE_DIRECT = 0 -const MODE_CONSTANT = 1 -const MODE_SMOOTH = 2 - -const ROTATION_SPEED = 1 -const SMOOTH_SPEED = 2.0 - -export(int, "Direct", "Constant", "Smooth") var mode = MODE_DIRECT - - -func _process(delta): - var mpos = get_viewport().get_mouse_pos() - - if (mode == MODE_DIRECT): - look_at(mpos) - elif (mode == MODE_CONSTANT): - var ang = get_angle_to(mpos) - var s = sign(ang) - ang = abs(ang) - - rotate(min(ang, ROTATION_SPEED*delta)*s) - elif (mode == MODE_SMOOTH): - var ang = get_angle_to(mpos) - - rotate(ang*delta*SMOOTH_SPEED) - - -func _ready(): - set_process(true) diff --git a/demos/2d/lookat/lookat.tscn b/demos/2d/lookat/lookat.tscn deleted file mode 100644 index 8505dcc972..0000000000 --- a/demos/2d/lookat/lookat.tscn +++ /dev/null @@ -1,32 +0,0 @@ -[gd_scene load_steps=3 format=1] - -[ext_resource path="res://arrow.png" type="Texture" id=1] -[ext_resource path="res://lookat.gd" type="Script" id=2] - -[node name="lookatscene" type="Node2D"] - -[node name="direct" type="Sprite" parent="."] - -transform/pos = Vector2( 132, 105 ) -texture = ExtResource( 1 ) -modulate = Color( 1, 0.799619, 0.734765, 1 ) -script/script = ExtResource( 2 ) -mode = 0 - -[node name="constant" type="Sprite" parent="."] - -transform/pos = Vector2( 611, 216 ) -texture = ExtResource( 1 ) -modulate = Color( 0.751241, 0.662843, 1, 1 ) -script/script = ExtResource( 2 ) -mode = 1 - -[node name="smooth" type="Sprite" parent="."] - -transform/pos = Vector2( 314, 457 ) -texture = ExtResource( 1 ) -modulate = Color( 0.749446, 1, 0.782884, 1 ) -script/script = ExtResource( 2 ) -mode = 2 - - |