added moving platforms and "collectable" coins and death barrier
This commit is contained in:
parent
709cee6893
commit
1573768619
@ -179,12 +179,15 @@ radius = 21.0
|
||||
height = 182.0
|
||||
|
||||
[node name="Tellick" type="CharacterBody2D"]
|
||||
z_index = 100
|
||||
collision_layer = 2
|
||||
script = ExtResource("1_q21sg")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(0, 2)
|
||||
scale = Vector2(0.2, 0.2)
|
||||
sprite_frames = SubResource("SpriteFrames_jl8dy")
|
||||
autoplay = "default"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CapsuleShape2D_aoset")
|
||||
|
@ -1,6 +1,6 @@
|
||||
extends CharacterBody2D
|
||||
|
||||
const SPEED = 300.0
|
||||
const SPEED = 600.0
|
||||
const JUMP_VELOCITY = -1000.0
|
||||
const MAX_JUMP_DURATION = 0.3
|
||||
const MIN_JUMP_DURATION = 0.01
|
||||
@ -46,3 +46,7 @@ func end_jump():
|
||||
if velocity.y < 0:
|
||||
velocity.y *= 0.20
|
||||
is_jumping = false
|
||||
|
||||
|
||||
func _on_kill_zone_body_entered(body: Node2D) -> void:
|
||||
pass # Replace with function body.
|
||||
|
BIN
Assets/Collectables/GoldCoin.png
Normal file
BIN
Assets/Collectables/GoldCoin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 663 B |
34
Assets/Collectables/GoldCoin.png.import
Normal file
34
Assets/Collectables/GoldCoin.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dj7grfg4awrf6"
|
||||
path="res://.godot/imported/GoldCoin.png-25b6ee75d6b11e5a23115548c7f446c1.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Collectables/GoldCoin.png"
|
||||
dest_files=["res://.godot/imported/GoldCoin.png-25b6ee75d6b11e5a23115548c7f446c1.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
66
Assets/Collectables/coin.tscn
Normal file
66
Assets/Collectables/coin.tscn
Normal file
@ -0,0 +1,66 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://ctysf55pres8y"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dj7grfg4awrf6" path="res://Assets/Collectables/GoldCoin.png" id="1_6uh7u"]
|
||||
[ext_resource type="Script" path="res://Scripts/coin.gd" id="1_isgrf"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6apv0"]
|
||||
atlas = ExtResource("1_6uh7u")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8md4o"]
|
||||
atlas = ExtResource("1_6uh7u")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ai3ca"]
|
||||
atlas = ExtResource("1_6uh7u")
|
||||
region = Rect2(32, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_sh070"]
|
||||
atlas = ExtResource("1_6uh7u")
|
||||
region = Rect2(48, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_pi3db"]
|
||||
atlas = ExtResource("1_6uh7u")
|
||||
region = Rect2(64, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_iigen"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6apv0")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_8md4o")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ai3ca")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_sh070")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_pi3db")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_piars"]
|
||||
|
||||
[node name="Coin" type="Area2D"]
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_isgrf")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
scale = Vector2(3, 3)
|
||||
sprite_frames = SubResource("SpriteFrames_iigen")
|
||||
autoplay = "default"
|
||||
frame_progress = 0.137011
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
scale = Vector2(2.08, 2.08)
|
||||
shape = SubResource("CircleShape2D_piars")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
[connection signal="body_entered" from="." to="CollisionShape2D" method="_on_coin_body_entered"]
|
17
Assets/World/Platforms/platform.tscn
Normal file
17
Assets/World/Platforms/platform.tscn
Normal file
@ -0,0 +1,17 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bqb3ccnlh1t0s"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://c8wfwo1nixh7d" path="res://Assets/World/Grounds/Dirt.png" id="1_4guyj"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vncw8"]
|
||||
size = Vector2(452, 48)
|
||||
|
||||
[node name="Platform" type="AnimatableBody2D"]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
scale = Vector2(0.2, 0.2)
|
||||
texture = ExtResource("1_4guyj")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(-11, 0)
|
||||
shape = SubResource("RectangleShape2D_vncw8")
|
||||
one_way_collision = true
|
20
Assets/World/kill_zone.tscn
Normal file
20
Assets/World/kill_zone.tscn
Normal file
@ -0,0 +1,20 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cyumvt28wwf28"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/kill_zone.gd" id="1_vfalm"]
|
||||
|
||||
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_6667c"]
|
||||
|
||||
[node name="KillZone" type="Area2D"]
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_vfalm")
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 0.6
|
||||
one_shot = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("WorldBoundaryShape2D_6667c")
|
||||
debug_color = Color(1, 0.012597, 0.0137024, 0.42)
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
11
Scripts/camera_2d.gd
Normal file
11
Scripts/camera_2d.gd
Normal file
@ -0,0 +1,11 @@
|
||||
extends Camera2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
16
Scripts/coin.gd
Normal file
16
Scripts/coin.gd
Normal file
@ -0,0 +1,16 @@
|
||||
extends Area2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
print("coin touched")
|
||||
queue_free()
|
23
Scripts/kill_zone.gd
Normal file
23
Scripts/kill_zone.gd
Normal file
@ -0,0 +1,23 @@
|
||||
extends Area2D
|
||||
@onready var timer: Timer = $Timer
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
print("you died")
|
||||
timer.start()
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
get_tree().reload_current_scene()
|
@ -32,3 +32,7 @@ move_right={
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
textures/canvas_textures/default_texture_filter=0
|
||||
|
101
world.tscn
101
world.tscn
@ -1,34 +1,99 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://b0jkivtwisycv"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://b0jkivtwisycv"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cny5b638kjd3w" path="res://Assets/Characters/Friendly/Tellik/Tellick.tscn" id="1_dgu6h"]
|
||||
[ext_resource type="PackedScene" uid="uid://eo08vhsoltt6" path="res://Assets/World/Grounds/Ground1.tscn" id="2_gboim"]
|
||||
[ext_resource type="Script" path="res://Scripts/camera_2d.gd" id="2_mpgh4"]
|
||||
[ext_resource type="PackedScene" uid="uid://bqb3ccnlh1t0s" path="res://Assets/World/Platforms/platform.tscn" id="3_i3imp"]
|
||||
[ext_resource type="PackedScene" uid="uid://ctysf55pres8y" path="res://Assets/Collectables/coin.tscn" id="4_qkdpl"]
|
||||
[ext_resource type="PackedScene" uid="uid://cyumvt28wwf28" path="res://Assets/World/kill_zone.tscn" id="6_6a5uv"]
|
||||
|
||||
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_5e4u7"]
|
||||
[sub_resource type="Animation" id="Animation_ya3iv"]
|
||||
resource_name = "move"
|
||||
length = 3.0
|
||||
loop_mode = 2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-645, 31), Vector2(-269, 23)]
|
||||
}
|
||||
|
||||
[sub_resource type="TileSet" id="TileSet_bke3u"]
|
||||
[sub_resource type="Animation" id="Animation_lrrse"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-645, 31)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_semk0"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_lrrse"),
|
||||
"move": SubResource("Animation_ya3iv")
|
||||
}
|
||||
|
||||
[node name="World" type="Node2D"]
|
||||
physics_interpolation_mode = 1
|
||||
|
||||
[node name="Tellick" parent="." instance=ExtResource("1_dgu6h")]
|
||||
position = Vector2(-39, 47)
|
||||
physics_interpolation_mode = 1
|
||||
position = Vector2(-245, -160)
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
[node name="Camera2D" type="Camera2D" parent="Tellick"]
|
||||
position = Vector2(-39, 93)
|
||||
zoom = Vector2(0.5, 0.5)
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||
position = Vector2(1, 140)
|
||||
shape = SubResource("WorldBoundaryShape2D_5e4u7")
|
||||
debug_color = Color(0.994873, 0.0645888, 1.15514e-06, 0.42)
|
||||
limit_bottom = 650
|
||||
position_smoothing_enabled = true
|
||||
script = ExtResource("2_mpgh4")
|
||||
|
||||
[node name="Ground1" parent="." instance=ExtResource("2_gboim")]
|
||||
position = Vector2(-279, 114)
|
||||
|
||||
[node name="TileMap" type="TileMap" parent="."]
|
||||
tile_set = SubResource("TileSet_bke3u")
|
||||
format = 2
|
||||
position = Vector2(-675, -57)
|
||||
|
||||
[node name="Ground2" parent="." instance=ExtResource("2_gboim")]
|
||||
position = Vector2(-245, -72)
|
||||
position = Vector2(-312, 71)
|
||||
|
||||
[node name="Platform" parent="." instance=ExtResource("3_i3imp")]
|
||||
position = Vector2(391, -56)
|
||||
|
||||
[node name="Platform2" parent="." instance=ExtResource("3_i3imp")]
|
||||
position = Vector2(-645, 31)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Platform2"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_semk0")
|
||||
}
|
||||
autoplay = "move"
|
||||
|
||||
[node name="Coin" parent="." instance=ExtResource("4_qkdpl")]
|
||||
position = Vector2(183, -124)
|
||||
|
||||
[node name="Coin2" parent="." instance=ExtResource("4_qkdpl")]
|
||||
position = Vector2(253, -124)
|
||||
|
||||
[node name="Coin3" parent="." instance=ExtResource("4_qkdpl")]
|
||||
position = Vector2(308, -124)
|
||||
|
||||
[node name="Coin4" parent="." instance=ExtResource("4_qkdpl")]
|
||||
position = Vector2(363, -129)
|
||||
|
||||
[node name="Coin5" parent="." instance=ExtResource("4_qkdpl")]
|
||||
position = Vector2(444, -121)
|
||||
|
||||
[node name="Coin6" parent="." instance=ExtResource("4_qkdpl")]
|
||||
position = Vector2(518, -127)
|
||||
|
||||
[node name="KillZone" parent="." instance=ExtResource("6_6a5uv")]
|
||||
position = Vector2(-2, 257)
|
||||
|
Loading…
Reference in New Issue
Block a user