-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.tscn
122 lines (96 loc) · 3.29 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
[gd_scene load_steps=9 format=2]
[ext_resource path="res://player_ghost.tres" type="SpriteFrames" id=1]
[ext_resource path="res://player_physical.tres" type="SpriteFrames" id=2]
[ext_resource path="res://vertical.cs" type="Script" id=3]
[ext_resource path="res://ambiance.wav" type="AudioStream" id=4]
[sub_resource type="CSharpScript" id=1]
script/source = "using Godot;
using System;
using Godot.Node2D;
using Godot.KinematicBody2D;
public class player : Node2D {
[Export] public float XStart = 0.0;
[Export] public float PhysicalStart = 0.0;
[Export] public float GhostStart = 0.0;
private KinematicBody2D physical = GetNode(\"Physical\");
private KinematicBody2D ghost = GetNode(\"Ghost\");
// Called when the node enters the scene tree for the first time.
public override void _Ready() {
physical = GetNode<KinematicBody2D>(\"Physical\");
physical.position.y = PhysicalStart;
ghost = GetNode<KinematicBody2D>(\"Ghost\");
ghost.position.y = GhostStart;
this.position.x = XStart;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(float delta) {
}
}
"
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 6.5, 14 )
[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 6.5, 2 )
[sub_resource type="RectangleShape2D" id=4]
extents = Vector2( 6.5, 2 )
[node name="Player" type="Node2D"]
script = SubResource( 1 )
MaxSpeed = 60.0
[node name="Physical" type="KinematicBody2D" parent="."]
collision_layer = 3
script = ExtResource( 3 )
JumpLen = 0.0
JumpSpeed = 0.0
TerminalVelocity = -160.0
Gravity = -320.0
[node name="AnimatedSprite" type="AnimatedSprite" parent="Physical"]
position = Vector2( 2, -4 )
frames = ExtResource( 2 )
animation = "climb_corner"
frame = 2
playing = true
offset = Vector2( -2, 0 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Physical"]
shape = SubResource( 2 )
[node name="RayCast2D" type="Area2D" parent="Physical"]
position = Vector2( 0, 13 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Physical/RayCast2D"]
shape = SubResource( 3 )
[node name="Timer" type="Timer" parent="Physical"]
one_shot = true
[node name="Climb" type="RayCast2D" parent="Physical"]
enabled = true
cast_to = Vector2( 14, 0 )
collision_mask = 4
[node name="CornerCheck" type="RayCast2D" parent="Physical"]
position = Vector2( 0, 20 )
enabled = true
cast_to = Vector2( 14, 0 )
collision_mask = 4
[node name="Audio" type="AudioStreamPlayer2D" parent="Physical"]
stream = ExtResource( 4 )
volume_db = -10.0
pitch_scale = 2.0
[node name="Ghost" type="KinematicBody2D" parent="."]
collision_layer = 3
script = ExtResource( 3 )
JumpLen = 0.1
JumpSpeed = 160.0
TerminalVelocity = -160.0
Gravity = -320.0
IsGhost = true
[node name="AnimatedSprite" type="AnimatedSprite" parent="Ghost"]
position = Vector2( 2, 3 )
frames = ExtResource( 1 )
animation = "idle"
playing = true
offset = Vector2( -2, 0 )
flip_v = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Ghost"]
shape = SubResource( 2 )
[node name="Timer" type="Timer" parent="Ghost"]
one_shot = true
[node name="RayCast2D" type="Area2D" parent="Ghost"]
position = Vector2( 0, -13 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Ghost/RayCast2D"]
shape = SubResource( 4 )