turning platforms have customizable start delay
This commit is contained in:
parent
63cf47305b
commit
629bc75fbb
5 changed files with 188 additions and 41 deletions
105
maps/canopy.tscn
105
maps/canopy.tscn
File diff suppressed because one or more lines are too long
|
@ -36,7 +36,7 @@ tile_set = ExtResource( 3 )
|
||||||
cell_size = Vector2( 8, 8 )
|
cell_size = Vector2( 8, 8 )
|
||||||
collision_layer = 9
|
collision_layer = 9
|
||||||
format = 1
|
format = 1
|
||||||
tile_data = PoolIntArray( 786454, 0, 65537, 786455, 0, 65537, 851990, 0, 65537, 917526, 0, 65537, 983061, 0, 65537, 983062, 0, 65537, 1048591, 0, 65537, 1048592, 0, 65537, 1048593, 0, 65537, 1048594, 0, 65537, 1114127, 0, 65537, 1179663, 0, 65537, 1245199, 0, 65537, 1310732, 0, 65537, 1310733, 0, 65537, 1310734, 0, 65537, 1310735, 0, 65537, 1441792, 0, 0, 1441793, 0, 0, 1441794, 0, 0, 1441795, 0, 0, 1441796, 0, 0, 1441797, 0, 0, 1441798, 0, 0, 1441799, 0, 0, 1441800, 0, 0, 1441801, 0, 0, 1441802, 0, 0, 1441803, 0, 0, 1441804, 0, 0, 1441805, 0, 0, 1441806, 0, 0, 1441807, 0, 0, 1441808, 0, 0, 1441809, 0, 0, 1441810, 0, 0, 1441811, 0, 0, 1441812, 0, 0, 1441813, 0, 0, 1441814, 0, 0, 1441815, 0, 0, 1441816, 0, 0, 1441817, 0, 0, 1441818, 0, 0, 1441819, 0, 0, 1441820, 0, 0, 1441821, 0, 0, 1441822, 0, 0, 1441823, 0, 0, 1507328, 0, 65537, 1507329, 0, 65537, 1507330, 0, 65537, 1507331, 0, 65537, 1507332, 0, 65537, 1507333, 0, 65537, 1507334, 0, 65537, 1507335, 0, 65537, 1507336, 0, 65537, 1507337, 0, 65537, 1507338, 0, 65537, 1507339, 0, 65537, 1507340, 0, 65537, 1507341, 0, 65537, 1507342, 0, 65537, 1507343, 0, 65537, 1507344, 0, 65537, 1507345, 0, 65537, 1507346, 0, 65537, 1507347, 0, 65537, 1507348, 0, 65537, 1507349, 0, 65537, 1507350, 0, 65537, 1507351, 0, 65537, 1507352, 0, 65537, 1507353, 0, 65537, 1507354, 0, 65537, 1507355, 0, 65537, 1507356, 0, 65537, 1507357, 0, 65537, 1507358, 0, 65537, 1507359, 0, 65537 )
|
tile_data = PoolIntArray( 786454, 0, 65537, 786455, 0, 65537, 851990, 0, 65537, 917526, 0, 65537, 983052, 0, 65537, 983053, 0, 65537, 983061, 0, 65537, 983062, 0, 65537, 1048591, 0, 65537, 1048592, 0, 65537, 1048593, 0, 65537, 1048594, 0, 65537, 1114127, 0, 65537, 1179663, 0, 65537, 1245199, 0, 65537, 1310732, 0, 65537, 1310733, 0, 65537, 1310734, 0, 65537, 1310735, 0, 65537, 1441792, 0, 0, 1441793, 0, 0, 1441794, 0, 0, 1441795, 0, 0, 1441796, 0, 0, 1441797, 0, 0, 1441798, 0, 0, 1441799, 0, 0, 1441800, 0, 0, 1441801, 0, 0, 1441802, 0, 0, 1441803, 0, 0, 1441804, 0, 0, 1441805, 0, 0, 1441806, 0, 0, 1441807, 0, 0, 1441808, 0, 0, 1441809, 0, 0, 1441810, 0, 0, 1441811, 0, 0, 1441812, 0, 0, 1441813, 0, 0, 1441814, 0, 0, 1441815, 0, 0, 1441816, 0, 0, 1441817, 0, 0, 1441818, 0, 0, 1441819, 0, 0, 1441820, 0, 0, 1441821, 0, 0, 1441822, 0, 0, 1441823, 0, 0, 1507328, 0, 65537, 1507329, 0, 65537, 1507330, 0, 65537, 1507331, 0, 65537, 1507332, 0, 65537, 1507333, 0, 65537, 1507334, 0, 65537, 1507335, 0, 65537, 1507336, 0, 65537, 1507337, 0, 65537, 1507338, 0, 65537, 1507339, 0, 65537, 1507340, 0, 65537, 1507341, 0, 65537, 1507342, 0, 65537, 1507343, 0, 65537, 1507344, 0, 65537, 1507345, 0, 65537, 1507346, 0, 65537, 1507347, 0, 65537, 1507348, 0, 65537, 1507349, 0, 65537, 1507350, 0, 65537, 1507351, 0, 65537, 1507352, 0, 65537, 1507353, 0, 65537, 1507354, 0, 65537, 1507355, 0, 65537, 1507356, 0, 65537, 1507357, 0, 65537, 1507358, 0, 65537, 1507359, 0, 65537 )
|
||||||
|
|
||||||
[node name="Rock" parent="." instance=ExtResource( 9 )]
|
[node name="Rock" parent="." instance=ExtResource( 9 )]
|
||||||
position = Vector2( 120, 120 )
|
position = Vector2( 120, 120 )
|
||||||
|
@ -48,7 +48,7 @@ position = Vector2( 84, -7 )
|
||||||
position = Vector2( 184, 163 )
|
position = Vector2( 184, 163 )
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource( 1 )]
|
[node name="Player" parent="." instance=ExtResource( 1 )]
|
||||||
position = Vector2( 72, 160 )
|
position = Vector2( 104, 96 )
|
||||||
|
|
||||||
[node name="Ladder3" parent="." instance=ExtResource( 8 )]
|
[node name="Ladder3" parent="." instance=ExtResource( 8 )]
|
||||||
position = Vector2( 40, 136 )
|
position = Vector2( 40, 136 )
|
||||||
|
@ -68,4 +68,20 @@ cell_size = Vector2( 8, 8 )
|
||||||
format = 1
|
format = 1
|
||||||
|
|
||||||
[node name="Turniwood5" parent="." instance=ExtResource( 12 )]
|
[node name="Turniwood5" parent="." instance=ExtResource( 12 )]
|
||||||
position = Vector2( 88, 136 )
|
position = Vector2( 80, 120 )
|
||||||
|
|
||||||
|
[node name="Turniwood6" parent="." instance=ExtResource( 12 )]
|
||||||
|
position = Vector2( 72, 112 )
|
||||||
|
delay = 0.5
|
||||||
|
|
||||||
|
[node name="Turniwood8" parent="." instance=ExtResource( 12 )]
|
||||||
|
position = Vector2( 64, 104 )
|
||||||
|
delay = 1.0
|
||||||
|
|
||||||
|
[node name="Turniwood7" parent="." instance=ExtResource( 12 )]
|
||||||
|
position = Vector2( 56, 96 )
|
||||||
|
delay = 1.5
|
||||||
|
|
||||||
|
[node name="Turniwood9" parent="." instance=ExtResource( 12 )]
|
||||||
|
position = Vector2( 48, 88 )
|
||||||
|
delay = 2.0
|
||||||
|
|
|
@ -1,25 +1,33 @@
|
||||||
extends Node2D
|
extends Node2D
|
||||||
onready var anims = $AnimationPlayer
|
onready var anims = $AnimationPlayer
|
||||||
onready var timer = $Timer
|
onready var flip_timer = $FlipTimer
|
||||||
|
onready var delay_timer = $DelayTimer
|
||||||
export var time:float = 60
|
export var time:float = 60
|
||||||
|
export var delay = 0.0
|
||||||
export(int, "Wood", "Yellow") var color
|
export(int, "Wood", "Yellow") var color
|
||||||
onready var time_ms = time * 0.0166666666666667 # Time is converted from frames @ 60fps to ms
|
onready var time_ms = time * 0.0166666666666667 # Time is converted from frames @ 60fps to ms
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
#Autostart animationplayer
|
#Auto start if delay variable is zero
|
||||||
|
if delay == 0.0:
|
||||||
anims.play("idle")
|
anims.play("idle")
|
||||||
timer.start(time_ms)
|
flip_timer.start(time_ms)
|
||||||
|
else:
|
||||||
func _physics_process(delta):
|
delay_timer.start(delay)
|
||||||
pass
|
|
||||||
#Debug.print(timer.)
|
|
||||||
|
|
||||||
func _on_AnimationPlayer_animation_finished(anim_name):
|
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||||
#Return to idle after turn animation
|
#Return to idle after turn animation
|
||||||
if anim_name == "turn":
|
if anim_name == "turn":
|
||||||
anims.play("idle")
|
anims.play("idle")
|
||||||
timer.start(time_ms)
|
flip_timer.start(time_ms)
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
Debug.print(delay_timer.get_time_left())
|
||||||
|
|
||||||
func _on_Timer_timeout():
|
func _on_FlipTimer_timeout():
|
||||||
anims.play("turn")
|
anims.play("turn")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_DelayTimer_timeout():
|
||||||
|
anims.play("idle")
|
||||||
|
flip_timer.start(time_ms)
|
||||||
|
|
|
@ -119,7 +119,11 @@ shape = SubResource( 1 )
|
||||||
anims/idle = SubResource( 2 )
|
anims/idle = SubResource( 2 )
|
||||||
anims/turn = SubResource( 3 )
|
anims/turn = SubResource( 3 )
|
||||||
|
|
||||||
[node name="Timer" type="Timer" parent="."]
|
[node name="FlipTimer" type="Timer" parent="."]
|
||||||
|
|
||||||
|
[node name="DelayTimer" type="Timer" parent="."]
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"]
|
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"]
|
||||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
[connection signal="timeout" from="FlipTimer" to="." method="_on_FlipTimer_timeout"]
|
||||||
|
[connection signal="timeout" from="DelayTimer" to="." method="_on_DelayTimer_timeout"]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=9 format=2]
|
[gd_scene load_steps=13 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://scripts/1px_border.gdshader" type="Shader" id=1]
|
[ext_resource path="res://scripts/1px_border.gdshader" type="Shader" id=1]
|
||||||
[ext_resource path="res://graphics/player/arrow.png" type="Texture" id=2]
|
[ext_resource path="res://graphics/player/arrow.png" type="Texture" id=2]
|
||||||
|
@ -13,12 +13,50 @@ shader_param/border_corners = true
|
||||||
[sub_resource type="Curve" id=3]
|
[sub_resource type="Curve" id=3]
|
||||||
_data = [ Vector2( 0, 1 ), 0.0, -0.139481, 0, 0, Vector2( 1, 0 ), -2.82064, 0.0, 0, 0 ]
|
_data = [ Vector2( 0, 1 ), 0.0, -0.139481, 0, 0, Vector2( 1, 0 ), -2.82064, 0.0, 0, 0 ]
|
||||||
|
|
||||||
|
[sub_resource type="CurveTexture" id=4]
|
||||||
|
width = 32
|
||||||
|
curve = SubResource( 3 )
|
||||||
|
|
||||||
|
[sub_resource type="ParticlesMaterial" id=5]
|
||||||
|
flag_disable_z = true
|
||||||
|
spread = 180.0
|
||||||
|
gravity = Vector3( 0, 0, 0 )
|
||||||
|
initial_velocity = 8.0
|
||||||
|
initial_velocity_random = 0.18
|
||||||
|
orbit_velocity = 0.0
|
||||||
|
orbit_velocity_random = 0.0
|
||||||
|
damping = 1.0
|
||||||
|
angle = 720.0
|
||||||
|
angle_random = 1.0
|
||||||
|
scale = 0.25
|
||||||
|
scale_random = 0.25
|
||||||
|
scale_curve = SubResource( 4 )
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=2]
|
[sub_resource type="RectangleShape2D" id=2]
|
||||||
extents = Vector2( 5.5, 3.5 )
|
extents = Vector2( 5.5, 3.5 )
|
||||||
|
|
||||||
[sub_resource type="Curve" id=6]
|
[sub_resource type="Curve" id=6]
|
||||||
_data = [ Vector2( 0, 1 ), 0.0, -1.45746, 0, 0, Vector2( 1, 0 ), 0.00323196, 0.0, 0, 0 ]
|
_data = [ Vector2( 0, 1 ), 0.0, -1.45746, 0, 0, Vector2( 1, 0 ), 0.00323196, 0.0, 0, 0 ]
|
||||||
|
|
||||||
|
[sub_resource type="CurveTexture" id=7]
|
||||||
|
width = 32
|
||||||
|
curve = SubResource( 6 )
|
||||||
|
|
||||||
|
[sub_resource type="ParticlesMaterial" id=8]
|
||||||
|
flag_disable_z = true
|
||||||
|
spread = 180.0
|
||||||
|
gravity = Vector3( 0, 0, 0 )
|
||||||
|
initial_velocity = 30.0
|
||||||
|
initial_velocity_random = 0.5
|
||||||
|
orbit_velocity = 0.0
|
||||||
|
orbit_velocity_random = 0.0
|
||||||
|
damping = 50.0
|
||||||
|
angle = 720.0
|
||||||
|
angle_random = 1.0
|
||||||
|
scale = 0.3
|
||||||
|
scale_curve = SubResource( 7 )
|
||||||
|
color = Color( 1, 1, 0.290196, 1 )
|
||||||
|
|
||||||
[node name="ArrowProjectile" type="Node2D"]
|
[node name="ArrowProjectile" type="Node2D"]
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
|
|
||||||
|
@ -27,23 +65,14 @@ material = SubResource( 1 )
|
||||||
z_index = -1
|
z_index = -1
|
||||||
texture = ExtResource( 2 )
|
texture = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="DustParticles" type="CPUParticles2D" parent="."]
|
[node name="DustParticles" type="Particles2D" parent="."]
|
||||||
show_behind_parent = true
|
show_behind_parent = true
|
||||||
position = Vector2( -4, 0 )
|
position = Vector2( -4, 0 )
|
||||||
z_index = -1
|
z_index = -1
|
||||||
amount = 24
|
amount = 24
|
||||||
local_coords = false
|
local_coords = false
|
||||||
|
process_material = SubResource( 5 )
|
||||||
texture = ExtResource( 4 )
|
texture = ExtResource( 4 )
|
||||||
spread = 180.0
|
|
||||||
gravity = Vector2( 0, 0 )
|
|
||||||
initial_velocity = 8.0
|
|
||||||
initial_velocity_random = 0.18
|
|
||||||
damping = 1.0
|
|
||||||
angle = 720.0
|
|
||||||
angle_random = 1.0
|
|
||||||
scale_amount = 0.25
|
|
||||||
scale_amount_random = 0.25
|
|
||||||
scale_amount_curve = SubResource( 3 )
|
|
||||||
|
|
||||||
[node name="Hitbox" type="Area2D" parent="." groups=["arrow"]]
|
[node name="Hitbox" type="Area2D" parent="." groups=["arrow"]]
|
||||||
|
|
||||||
|
@ -51,24 +80,15 @@ scale_amount_curve = SubResource( 3 )
|
||||||
position = Vector2( -0.5, -0.5 )
|
position = Vector2( -0.5, -0.5 )
|
||||||
shape = SubResource( 2 )
|
shape = SubResource( 2 )
|
||||||
|
|
||||||
[node name="SparkParticles" type="CPUParticles2D" parent="."]
|
[node name="SparkParticles" type="Particles2D" parent="."]
|
||||||
position = Vector2( 4, 0 )
|
position = Vector2( 4, 0 )
|
||||||
emitting = false
|
emitting = false
|
||||||
amount = 16
|
amount = 16
|
||||||
lifetime = 0.5
|
lifetime = 0.5
|
||||||
one_shot = true
|
one_shot = true
|
||||||
explosiveness = 1.0
|
explosiveness = 1.0
|
||||||
|
process_material = SubResource( 8 )
|
||||||
texture = ExtResource( 4 )
|
texture = ExtResource( 4 )
|
||||||
spread = 180.0
|
|
||||||
gravity = Vector2( 0, 0 )
|
|
||||||
initial_velocity = 30.0
|
|
||||||
initial_velocity_random = 0.5
|
|
||||||
damping = 50.0
|
|
||||||
angle = 720.0
|
|
||||||
angle_random = 1.0
|
|
||||||
scale_amount = 0.3
|
|
||||||
scale_amount_curve = SubResource( 6 )
|
|
||||||
color = Color( 1, 1, 0.290196, 1 )
|
|
||||||
|
|
||||||
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
|
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
|
||||||
[connection signal="body_entered" from="Hitbox" to="." method="_on_Hitbox_body_entered"]
|
[connection signal="body_entered" from="Hitbox" to="." method="_on_Hitbox_body_entered"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue