Spring spike trap
This commit is contained in:
parent
4b9d3a0b1b
commit
328f0275f7
14 changed files with 384 additions and 11 deletions
|
@ -1,6 +1,9 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://assets/Tiles/spikes.png" type="Texture" id=1]
|
||||
[ext_resource path="res://assets/Tiles/spikes_left.png" type="Texture" id=2]
|
||||
[ext_resource path="res://assets/Tiles/spikes_bottom.png" type="Texture" id=3]
|
||||
[ext_resource path="res://assets/Tiles/spikes_right.png" type="Texture" id=4]
|
||||
|
||||
[sub_resource type="OccluderPolygon2D" id=1]
|
||||
polygon = PoolVector2Array( 0, 13.9545, 0, 13.7219, 3.48895, 8.37286, 6.97746, 14.1871, 11.6288, 8.1403, 15.3499, 13.7219, 16, 14.1871, 16, 16, 0, 16 )
|
||||
|
@ -8,7 +11,16 @@ polygon = PoolVector2Array( 0, 13.9545, 0, 13.7219, 3.48895, 8.37286, 6.97746, 1
|
|||
[sub_resource type="ConvexPolygonShape2D" id=2]
|
||||
points = PoolVector2Array( 16, 16, 0, 16, 0, 7.90773, 16, 7.90773 )
|
||||
|
||||
[sub_resource type="TileSet" id=3]
|
||||
[sub_resource type="ConvexPolygonShape2D" id=3]
|
||||
points = PoolVector2Array( 16, 7.28073, 0, 7.28073, 0, 0, 16, 0 )
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=4]
|
||||
points = PoolVector2Array( 7.49643, 16, 0, 16, 0, 0, 7.49643, 0 )
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=6]
|
||||
points = PoolVector2Array( 8.39368, 0, 16, 0, 16, 16, 8.39368, 16 )
|
||||
|
||||
[sub_resource type="TileSet" id=5]
|
||||
0/name = "spikes.png 0"
|
||||
0/texture = ExtResource( 1 )
|
||||
0/tex_offset = Vector2( 0, 0 )
|
||||
|
@ -31,9 +43,72 @@ points = PoolVector2Array( 16, 16, 0, 16, 0, 7.90773, 16, 7.90773 )
|
|||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
} ]
|
||||
0/z_index = 0
|
||||
1/name = "spikes_bottom.png 1"
|
||||
1/texture = ExtResource( 3 )
|
||||
1/tex_offset = Vector2( 0, 0 )
|
||||
1/modulate = Color( 1, 1, 1, 1 )
|
||||
1/region = Rect2( 0, 0, 16, 16 )
|
||||
1/tile_mode = 0
|
||||
1/occluder_offset = Vector2( 0, 0 )
|
||||
1/navigation_offset = Vector2( 0, 0 )
|
||||
1/shape_offset = Vector2( 0, 0 )
|
||||
1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
1/shape = SubResource( 3 )
|
||||
1/shape_one_way = false
|
||||
1/shape_one_way_margin = 1.0
|
||||
1/shapes = [ {
|
||||
"autotile_coord": Vector2( 0, 0 ),
|
||||
"one_way": false,
|
||||
"one_way_margin": 1.0,
|
||||
"shape": SubResource( 3 ),
|
||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
} ]
|
||||
1/z_index = 0
|
||||
2/name = "spikes_left.png 2"
|
||||
2/texture = ExtResource( 2 )
|
||||
2/tex_offset = Vector2( 0, 0 )
|
||||
2/modulate = Color( 1, 1, 1, 1 )
|
||||
2/region = Rect2( 0, 0, 16, 16 )
|
||||
2/tile_mode = 0
|
||||
2/occluder_offset = Vector2( 0, 0 )
|
||||
2/navigation_offset = Vector2( 0, 0 )
|
||||
2/shape_offset = Vector2( 0, 0 )
|
||||
2/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
2/shape = SubResource( 4 )
|
||||
2/shape_one_way = false
|
||||
2/shape_one_way_margin = 1.0
|
||||
2/shapes = [ {
|
||||
"autotile_coord": Vector2( 0, 0 ),
|
||||
"one_way": false,
|
||||
"one_way_margin": 1.0,
|
||||
"shape": SubResource( 4 ),
|
||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
} ]
|
||||
2/z_index = 0
|
||||
3/name = "spikes_right.png 3"
|
||||
3/texture = ExtResource( 4 )
|
||||
3/tex_offset = Vector2( 0, 0 )
|
||||
3/modulate = Color( 1, 1, 1, 1 )
|
||||
3/region = Rect2( 0, 0, 16, 16 )
|
||||
3/tile_mode = 0
|
||||
3/occluder_offset = Vector2( 0, 0 )
|
||||
3/navigation_offset = Vector2( 0, 0 )
|
||||
3/shape_offset = Vector2( 0, 0 )
|
||||
3/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
3/shape = SubResource( 6 )
|
||||
3/shape_one_way = false
|
||||
3/shape_one_way_margin = 1.0
|
||||
3/shapes = [ {
|
||||
"autotile_coord": Vector2( 0, 0 ),
|
||||
"one_way": false,
|
||||
"one_way_margin": 1.0,
|
||||
"shape": SubResource( 6 ),
|
||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
} ]
|
||||
3/z_index = 0
|
||||
|
||||
[node name="TrapTiles" type="TileMap"]
|
||||
tile_set = SubResource( 3 )
|
||||
tile_set = SubResource( 5 )
|
||||
cell_size = Vector2( 16, 16 )
|
||||
collision_layer = 4
|
||||
occluder_light_mask = 0
|
||||
|
|
BIN
assets/Tiles/spikes-sheet.png
Normal file
BIN
assets/Tiles/spikes-sheet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 453 B |
34
assets/Tiles/spikes-sheet.png.import
Normal file
34
assets/Tiles/spikes-sheet.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/spikes-sheet.png-8cb38b773622e159ea2eb805902c3b6d.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Tiles/spikes-sheet.png"
|
||||
dest_files=[ "res://.import/spikes-sheet.png-8cb38b773622e159ea2eb805902c3b6d.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
assets/Tiles/spikes_bottom.png
Normal file
BIN
assets/Tiles/spikes_bottom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 165 B |
34
assets/Tiles/spikes_bottom.png.import
Normal file
34
assets/Tiles/spikes_bottom.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/spikes_bottom.png-ad9205c44f656fa2f80cbaf19ec47299.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Tiles/spikes_bottom.png"
|
||||
dest_files=[ "res://.import/spikes_bottom.png-ad9205c44f656fa2f80cbaf19ec47299.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
assets/Tiles/spikes_left.png
Normal file
BIN
assets/Tiles/spikes_left.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 191 B |
34
assets/Tiles/spikes_left.png.import
Normal file
34
assets/Tiles/spikes_left.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/spikes_left.png-819b5c61c48dea77905980d3c543618f.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Tiles/spikes_left.png"
|
||||
dest_files=[ "res://.import/spikes_left.png-819b5c61c48dea77905980d3c543618f.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
assets/Tiles/spikes_right.png
Normal file
BIN
assets/Tiles/spikes_right.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 175 B |
34
assets/Tiles/spikes_right.png.import
Normal file
34
assets/Tiles/spikes_right.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/spikes_right.png-f2c2bb253214c16e3733546af0d7ce27.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Tiles/spikes_right.png"
|
||||
dest_files=[ "res://.import/spikes_right.png-f2c2bb253214c16e3733546af0d7ce27.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
|
@ -115,6 +115,29 @@ enabled=PoolStringArray( )
|
|||
|
||||
theme/custom="res://assets/Theme/Theme.tres"
|
||||
|
||||
[importer_defaults]
|
||||
|
||||
texture={
|
||||
"compress/bptc_ldr": 0,
|
||||
"compress/hdr_mode": 0,
|
||||
"compress/lossy_quality": 0.7,
|
||||
"compress/mode": 0,
|
||||
"compress/normal_map": 0,
|
||||
"detect_3d": false,
|
||||
"flags/anisotropic": false,
|
||||
"flags/filter": false,
|
||||
"flags/mipmaps": false,
|
||||
"flags/repeat": 0,
|
||||
"flags/srgb": 2,
|
||||
"process/HDR_as_SRGB": false,
|
||||
"process/fix_alpha_border": true,
|
||||
"process/invert_color": false,
|
||||
"process/premult_alpha": false,
|
||||
"size_limit": 0,
|
||||
"stream": false,
|
||||
"svg/scale": 1.0
|
||||
}
|
||||
|
||||
[input]
|
||||
|
||||
ui_accept={
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=24 format=2]
|
||||
[gd_scene load_steps=25 format=2]
|
||||
|
||||
[ext_resource path="res://src/GameWorld/Levels/PreGame.gd" type="Script" id=1]
|
||||
[ext_resource path="res://assets/Tiles/background_0.png" type="Texture" id=2]
|
||||
|
@ -15,6 +15,7 @@
|
|||
[ext_resource path="res://src/Actors/WiseOldDude/WiseOldDude.tscn" type="PackedScene" id=13]
|
||||
[ext_resource path="res://src/GameWorld/AmbiantLighting.tscn" type="PackedScene" id=14]
|
||||
[ext_resource path="res://src/Scripts/WarpZone.tscn" type="PackedScene" id=15]
|
||||
[ext_resource path="res://src/Hazards/SpikeTrap.tscn" type="PackedScene" id=16]
|
||||
|
||||
[sub_resource type="TileSet" id=1]
|
||||
0/name = "tileset.png 0"
|
||||
|
@ -265,4 +266,7 @@ position = Vector2( 535, 42 )
|
|||
[node name="WarpZone" parent="." instance=ExtResource( 15 )]
|
||||
position = Vector2( 723, 225 )
|
||||
to_level_coord = Vector2( 0, 1 )
|
||||
|
||||
[node name="SpikeTrap" parent="." instance=ExtResource( 16 )]
|
||||
position = Vector2( 352, 208 )
|
||||
[connection signal="body_entered" from="CutsceneAreas/OldDudeIntroArea" to="." method="_on_OldDudeIntroArea_body_entered"]
|
||||
|
|
16
src/Hazards/SpikeTrap.gd
Normal file
16
src/Hazards/SpikeTrap.gd
Normal file
|
@ -0,0 +1,16 @@
|
|||
extends Node2D
|
||||
|
||||
var triggerd = false
|
||||
|
||||
func _on_DamageArea_body_entered(body: Node) -> void:
|
||||
if body.name == "Player":
|
||||
body.die()
|
||||
|
||||
func _on_TriggerArea_body_entered(body: Node) -> void:
|
||||
if body.name == "Player" and not triggerd:
|
||||
triggerd = true
|
||||
$AnimationPlayer.play("emit")
|
||||
yield($AnimationPlayer, "animation_finished")
|
||||
yield(get_tree().create_timer(.3), "timeout")
|
||||
$AnimationPlayer.play_backwards("emit")
|
||||
triggerd = false
|
97
src/Hazards/SpikeTrap.tscn
Normal file
97
src/Hazards/SpikeTrap.tscn
Normal file
|
@ -0,0 +1,97 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://assets/Tiles/spikes-sheet.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/Hazards/SpikeTrap.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 5, 8 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=3]
|
||||
extents = Vector2( 10, 8 )
|
||||
|
||||
[sub_resource type="Animation" id=4]
|
||||
resource_name = "emit"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:frame")
|
||||
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, 0.3, 0.4 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ 0, 1, 2, 3, 4 ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("DamageArea/CollisionShape2D:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( -11, -8 ), Vector2( -9, -8 ), Vector2( -3, -8 ), Vector2( 5, -8 ), Vector2( 5, -8 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=2]
|
||||
resource_name = "idle"
|
||||
length = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ 0 ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("DamageArea/CollisionShape2D:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( -11, -8 ) ]
|
||||
}
|
||||
|
||||
[node name="SpikeTrap" type="Node2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
position = Vector2( 0, -8 )
|
||||
texture = ExtResource( 1 )
|
||||
hframes = 6
|
||||
|
||||
[node name="DamageArea" type="Area2D" parent="."]
|
||||
visible = false
|
||||
collision_layer = 4
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageArea"]
|
||||
position = Vector2( -11, -8 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="TriggerArea" type="Area2D" parent="."]
|
||||
visible = false
|
||||
collision_layer = 0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="TriggerArea"]
|
||||
position = Vector2( 4, -8 )
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
playback_speed = 2.5
|
||||
anims/emit = SubResource( 4 )
|
||||
anims/idle = SubResource( 2 )
|
||||
[connection signal="body_entered" from="DamageArea" to="." method="_on_DamageArea_body_entered"]
|
||||
[connection signal="body_entered" from="TriggerArea" to="." method="_on_TriggerArea_body_entered"]
|
Loading…
Reference in a new issue