-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.tscn
146 lines (127 loc) · 3.72 KB
/
Player.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
[gd_scene load_steps=13 format=2]
[ext_resource path="res://assets/cara_E.png" type="Texture" id=1]
[ext_resource path="res://scripts/player.gd" type="Script" id=2]
[ext_resource path="res://assets/PlayerLightCircle.png" type="Texture" id=3]
[ext_resource path="res://assets/cara_N.png" type="Texture" id=4]
[ext_resource path="res://assets/cara_S.png" type="Texture" id=5]
[ext_resource path="res://assets/cara_W.png" type="Texture" id=6]
[ext_resource path="res://assets/Shadow.png" type="Texture" id=7]
[sub_resource type="SpriteFrames" id=2]
animations = [ {
"frames": [ ExtResource( 1 ) ],
"loop": true,
"name": "right",
"speed": 2.0
}, {
"frames": [ ExtResource( 6 ) ],
"loop": true,
"name": "left",
"speed": 2.0
}, {
"frames": [ ExtResource( 4 ) ],
"loop": true,
"name": "up",
"speed": 2.0
}, {
"frames": [ ExtResource( 5 ) ],
"loop": true,
"name": "down",
"speed": 2.0
} ]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 62, 62 )
[sub_resource type="Animation" id=3]
resource_name = "Jump"
length = 0.2
tracks/0/type = "value"
tracks/0/path = NodePath("Graphics/Sprite:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 0.2 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 2, -89 ), Vector2( 2, -120 ), Vector2( 2, -89 ) ]
}
[sub_resource type="Shader" id=4]
code = "shader_type canvas_item;
uniform float enclose_percent = 0;
uniform float wipe_percent = 0;
void fragment() {
float fake = mod(TIME, 2.0);
float enclose = enclose_percent;
float wipe = wipe_percent;
COLOR = vec4(0.0);
if (wipe > 0.0) {
vec2 offset = UV - vec2(0.5);
bool rhs = true;
if (offset.x < 0.0) {
offset *= -1.0;
rhs = false;
}
float angle = atan(offset[0], offset[1]) / 3.14;
if (rhs) angle += 1.0;
COLOR = vec4(vec3(angle / 4.0), 1.0);
COLOR = vec4(vec3(0.0), 0.0);
if (wipe < 0.5) {
if (wipe > angle / 4.0) COLOR.a = 1.0;
} else {
if (wipe - 0.5 < angle / 4.0) COLOR.a = 1.0;
}
} else if (enclose > 0.0) {
float dist_frac = distance(UV, vec2(0.5)) / 1.5;
if (enclose < 0.5) {
if (dist_frac > 0.5 - enclose)
COLOR.a = 1.0;
} else {
if (dist_frac > enclose - 0.5)
COLOR.a = 1.0;
}
} else {
COLOR = vec4(0.0);
}
}"
[sub_resource type="ShaderMaterial" id=5]
shader = SubResource( 4 )
shader_param/enclose_percent = 0.0
shader_param/wipe_percent = 0.0
[node name="Player" type="KinematicBody2D"]
position = Vector2( 2, -1 )
collision_layer = 2
collision_mask = 508
script = ExtResource( 2 )
[node name="Graphics" type="Node2D" parent="."]
[node name="Shadow" type="Sprite" parent="Graphics"]
modulate = Color( 0.113725, 0.0784314, 0.192157, 0.466667 )
position = Vector2( 64.5, 66.5 )
scale = Vector2( 0.13, 0.106 )
texture = ExtResource( 3 )
[node name="Sprite" type="AnimatedSprite" parent="Graphics"]
light_mask = 0
position = Vector2( 2, -89 )
scale = Vector2( 0.5, 0.5 )
frames = SubResource( 2 )
animation = "right"
centered = false
[node name="LightSource" type="Light2D" parent="Graphics"]
light_mask = 3
position = Vector2( 64, 26 )
scale = Vector2( 3, 3 )
texture = ExtResource( 3 )
texture_scale = 10.0
shadow_enabled = true
[node name="Shape" type="CollisionShape2D" parent="."]
position = Vector2( 64, 64 )
shape = SubResource( 1 )
[node name="Animation" type="AnimationPlayer" parent="."]
anims/Jump = SubResource( 3 )
[node name="Tween" type="Tween" parent="."]
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Overlay" type="Sprite" parent="CanvasLayer"]
material = SubResource( 5 )
position = Vector2( 512, 300 )
scale = Vector2( 16, 16 )
z_index = 2
texture = ExtResource( 7 )