-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunder_pressure.tscn
59 lines (41 loc) · 1.61 KB
/
under_pressure.tscn
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
[gd_scene load_steps=4 format=2]
[ext_resource path="res://icon.png" type="Texture" id=1]
[sub_resource type="GDScript" id=1]
script/source = "extends Node2D
var offset
func _input(event):
# if event is InputEventMouseMotion:
# find_node(\"Camera2D\").position += event.relative
if Input.is_key_pressed(KEY_SPACE):
if event is InputEventMouseMotion:
find_node(\"icon\").position.x = event.position.x
# find_node(\"icon\").scale = Vector2.ONE*0.1 / clamp((0.05+event.pressure*0.1),0.01,1)
find_node(\"ParallaxLayer\").scale = Vector2.ONE*event.pressure
# find_node(\"icon\").rotation = event.tilt.rotated(deg2rad(90)).angle()# + offset_rotation
if event is InputEventKey:
if event.scancode == KEY_SPACE:
if event.pressed:
offset = find_node(\"icon\").transform
if not event.pressed:
# find_node(\"ParallaxBackground\").add_child(
find_node(\"ParallaxLayer\").duplicate() #)
"
[sub_resource type="GDScript" id=2]
script/source = "extends Camera2D
func _process(delta):
if Input.is_key_pressed(KEY_A): position.x -= 10
if Input.is_key_pressed(KEY_D): position.x += 10
"
[node name="Node2D" type="Node2D"]
script = SubResource( 1 )
[node name="Camera2D" type="Camera2D" parent="."]
current = true
smoothing_enabled = true
editor_draw_limits = true
editor_draw_drag_margin = true
script = SubResource( 2 )
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
[node name="icon" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
position = Vector2( 165.731, 99.7313 )
texture = ExtResource( 1 )