156 lines
3.7 KiB
Plaintext
156 lines
3.7 KiB
Plaintext
[gd_scene load_steps=6 format=2]
|
|
|
|
[ext_resource path="res://icon.png" type="Texture" id=1]
|
|
|
|
[sub_resource type="GDScript" id=1]
|
|
script/source = "extends KinematicBody2D
|
|
|
|
const UP = Vector2(0, -1)
|
|
const GRAVITY = 20
|
|
const SPEED = 200
|
|
const JUMP_HEIGHT = -500
|
|
var motion = Vector2()
|
|
|
|
func _physics_process(delta):
|
|
motion.y += GRAVITY
|
|
|
|
if Input.is_action_pressed(\"dp_right\"):
|
|
motion.x = SPEED
|
|
elif Input.is_action_pressed(\"dp_left\"):
|
|
motion.x = -SPEED
|
|
else:
|
|
motion.x = 0
|
|
|
|
if is_on_floor():
|
|
if Input.is_action_just_pressed(\"nin_b\"):
|
|
motion.y = JUMP_HEIGHT
|
|
|
|
if Input.is_action_just_pressed(\"select\"):
|
|
get_tree().quit()
|
|
|
|
move_and_slide(motion, UP)
|
|
pass
|
|
"
|
|
|
|
[sub_resource type="SpriteFrames" id=2]
|
|
animations = [ {
|
|
"frames": [ ExtResource( 1 ) ],
|
|
"loop": true,
|
|
"name": "default",
|
|
"speed": 5.0
|
|
} ]
|
|
|
|
[sub_resource type="RectangleShape2D" id=3]
|
|
extents = Vector2( 32, 32 )
|
|
|
|
[sub_resource type="RectangleShape2D" id=4]
|
|
extents = Vector2( 32, 32 )
|
|
|
|
[node name="LevelOne" type="Node"]
|
|
|
|
[node name="Player" type="KinematicBody2D" parent="."]
|
|
position = Vector2( 608, 160 )
|
|
script = SubResource( 1 )
|
|
__meta__ = {
|
|
"_edit_group_": true
|
|
}
|
|
|
|
[node name="AnimatedSprite" type="AnimatedSprite" parent="Player"]
|
|
frames = SubResource( 2 )
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player"]
|
|
shape = SubResource( 3 )
|
|
|
|
[node name="Walls" type="Node" parent="."]
|
|
|
|
[node name="Wall" type="StaticBody2D" parent="Walls"]
|
|
position = Vector2( 608, 288 )
|
|
__meta__ = {
|
|
"_edit_group_": true
|
|
}
|
|
|
|
[node name="Sprite" type="Sprite" parent="Walls/Wall"]
|
|
modulate = Color( 0, 0, 0, 1 )
|
|
texture = ExtResource( 1 )
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Walls/Wall"]
|
|
shape = SubResource( 4 )
|
|
|
|
[node name="Wall2" type="StaticBody2D" parent="Walls"]
|
|
position = Vector2( 672, 288 )
|
|
__meta__ = {
|
|
"_edit_group_": true
|
|
}
|
|
|
|
[node name="Sprite" type="Sprite" parent="Walls/Wall2"]
|
|
modulate = Color( 0, 0, 0, 1 )
|
|
texture = ExtResource( 1 )
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Walls/Wall2"]
|
|
shape = SubResource( 4 )
|
|
|
|
[node name="Wall3" type="StaticBody2D" parent="Walls"]
|
|
position = Vector2( 736, 288 )
|
|
__meta__ = {
|
|
"_edit_group_": true
|
|
}
|
|
|
|
[node name="Sprite" type="Sprite" parent="Walls/Wall3"]
|
|
modulate = Color( 0, 0, 0, 1 )
|
|
texture = ExtResource( 1 )
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Walls/Wall3"]
|
|
shape = SubResource( 4 )
|
|
|
|
[node name="Wall4" type="StaticBody2D" parent="Walls"]
|
|
position = Vector2( 800, 288 )
|
|
__meta__ = {
|
|
"_edit_group_": true
|
|
}
|
|
|
|
[node name="Sprite" type="Sprite" parent="Walls/Wall4"]
|
|
modulate = Color( 0, 0, 0, 1 )
|
|
texture = ExtResource( 1 )
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Walls/Wall4"]
|
|
shape = SubResource( 4 )
|
|
|
|
[node name="Wall5" type="StaticBody2D" parent="Walls"]
|
|
position = Vector2( 544, 288 )
|
|
__meta__ = {
|
|
"_edit_group_": true
|
|
}
|
|
|
|
[node name="Sprite" type="Sprite" parent="Walls/Wall5"]
|
|
modulate = Color( 0, 0, 0, 1 )
|
|
texture = ExtResource( 1 )
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Walls/Wall5"]
|
|
shape = SubResource( 4 )
|
|
|
|
[node name="Wall6" type="StaticBody2D" parent="Walls"]
|
|
position = Vector2( 480, 288 )
|
|
__meta__ = {
|
|
"_edit_group_": true
|
|
}
|
|
|
|
[node name="Sprite" type="Sprite" parent="Walls/Wall6"]
|
|
modulate = Color( 0, 0, 0, 1 )
|
|
texture = ExtResource( 1 )
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Walls/Wall6"]
|
|
shape = SubResource( 4 )
|
|
|
|
[node name="Wall7" type="StaticBody2D" parent="Walls"]
|
|
position = Vector2( 416, 288 )
|
|
__meta__ = {
|
|
"_edit_group_": true
|
|
}
|
|
|
|
[node name="Sprite" type="Sprite" parent="Walls/Wall7"]
|
|
modulate = Color( 0, 0, 0, 1 )
|
|
texture = ExtResource( 1 )
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Walls/Wall7"]
|
|
shape = SubResource( 4 )
|