forked from team-sg/hero-mark-2
changed the way the fall sprite works
This commit is contained in:
parent
67e9a93b2b
commit
929b63c454
10 changed files with 179 additions and 42 deletions
|
@ -3,6 +3,7 @@ extends Area2D
|
|||
export var speed = 16.0
|
||||
|
||||
onready var sprite = $Sprite
|
||||
onready var activation_timer = $ActivationTimer
|
||||
|
||||
var lifetime = 0.0
|
||||
|
||||
|
@ -15,10 +16,16 @@ func _physics_process(delta):
|
|||
sprite.position.x = sin(lifetime * 4.0) * 4.0
|
||||
position.y -= speed * delta
|
||||
|
||||
func _on_Bubble_body_entered(body):
|
||||
func pop():
|
||||
sprite.frame_coords.y = 1
|
||||
speed = 0.0
|
||||
get_tree().create_timer(0.5, false).connect("timeout", self, "queue_free")
|
||||
|
||||
func _on_Bubble_body_entered(body):
|
||||
if body.is_in_group("player"):
|
||||
body.oxygen_timer.start()
|
||||
Audio.play_sound(Audio.a_bubble,Audio.ac_die)
|
||||
pop()
|
||||
elif activation_timer.time_left == 0:
|
||||
pop()
|
||||
|
||||
|
|
|
@ -17,5 +17,11 @@ vframes = 2
|
|||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="ActivationTimer" type="Timer" parent="."]
|
||||
autostart = true
|
||||
__meta__ = {
|
||||
"_editor_description_": "timer until the bubble can be broken by objects other than the player"
|
||||
}
|
||||
|
||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||
[connection signal="body_entered" from="." to="." method="_on_Bubble_body_entered"]
|
||||
|
|
11
objects/environment/bubble/bubble_spawner.tscn
Normal file
11
objects/environment/bubble/bubble_spawner.tscn
Normal file
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://objects/environment/bubble/bubble.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://scripts/random_spawner.gd" type="Script" id=2]
|
||||
|
||||
[node name="BubbleSpawner" type="Node2D"]
|
||||
position = Vector2( 16, 158 )
|
||||
script = ExtResource( 2 )
|
||||
scene = ExtResource( 1 )
|
||||
extents = Rect2( 0, 0, 16, 8 )
|
||||
delay = 3.0
|
|
@ -34,8 +34,8 @@ func _ready():
|
|||
tween.tween_interval(3.0)
|
||||
tween.tween_property(music, "rect_position:x", 256.0, 1.0)
|
||||
#Show oxygen meter when underwater
|
||||
var player = get_tree().get_nodes_in_group("player").pop_back()
|
||||
if player.underwater == true: oxygen.visible = true
|
||||
# var player = get_tree().get_nodes_in_group("player").pop_back()
|
||||
# if player.underwater == true: oxygen.visible = true
|
||||
|
||||
func shard_popup(shard_number):
|
||||
#Change text to song name
|
||||
|
@ -84,7 +84,7 @@ func _physics_process(delta):
|
|||
time_counter.modulate = bonus_color
|
||||
else:
|
||||
time_counter.modulate = Color.white
|
||||
#Oxygen meter
|
||||
var player = get_tree().get_nodes_in_group("player").pop_back()
|
||||
oxygen_meter.scale.x = player.oxygen_timer.time_left
|
||||
# #Oxygen meter
|
||||
# var player = get_tree().get_nodes_in_group("player").pop_back()
|
||||
# oxygen_meter.scale.x = player.oxygen_timer.time_left
|
||||
#if oxygen_meter.scale.x > 15: oxygen_meter.scale.x = 15
|
||||
|
|
|
@ -52,7 +52,7 @@ onready var ladder_detector: RayCast2D = $"%LadderDetector"
|
|||
onready var death_splatter_position: Position2D = $"%DeathSplatterPosition"
|
||||
onready var pushable_detector: RayCast2D = $"%PushableDetector"
|
||||
onready var oxygen_timer = $OxygenTimer
|
||||
onready var oxygen_origin = oxygen_timer.wait_time
|
||||
onready var low_oxygen_label = $LowOxygenLabel
|
||||
|
||||
# OVERRIDES #
|
||||
func _ready() -> void:
|
||||
|
@ -100,6 +100,15 @@ func _physics_process(delta: float) -> void:
|
|||
if ladder_detector.is_colliding():
|
||||
state_chart.send_event("ladder_touched")
|
||||
|
||||
# show oxygen count on low oxygen
|
||||
if underwater:
|
||||
if oxygen_timer.time_left < 5:
|
||||
low_oxygen_label.text = str(floor(oxygen_timer.time_left) + 1)
|
||||
else:
|
||||
low_oxygen_label.text = ""
|
||||
else:
|
||||
low_oxygen_label.text = ""
|
||||
|
||||
#Cheats
|
||||
#CFox mode
|
||||
if Debug.cfox_mode == true:
|
||||
|
@ -175,7 +184,7 @@ func _on_NormalJump_state_exited() -> void:
|
|||
func _on_LadderJump_state_entered() -> void:
|
||||
velocity.y = -jump_force
|
||||
Audio.play_sound(Audio.a_jump, Audio.ac_jump)
|
||||
animation_player.play("jump")
|
||||
animation_player.play("ladder_jump")
|
||||
|
||||
func _on_DoubleJump_state_entered() -> void:
|
||||
velocity.y = -double_jump_force
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=45 format=2]
|
||||
[gd_scene load_steps=48 format=2]
|
||||
|
||||
[ext_resource path="res://objects/player/player.gd" type="Script" id=1]
|
||||
[ext_resource path="res://graphics/player/palettes/default.png" type="Texture" id=2]
|
||||
|
@ -24,6 +24,8 @@
|
|||
[ext_resource path="res://graphics/player/sg_blink.png" type="Texture" id=22]
|
||||
[ext_resource path="res://graphics/player/sg_stim.png" type="Texture" id=23]
|
||||
[ext_resource path="res://graphics/player/sg_duck.png" type="Texture" id=24]
|
||||
[ext_resource path="res://ui/2ndpuberty_outline.tres" type="Material" id=25]
|
||||
[ext_resource path="res://graphics/player/sg_jump_ladder.png" type="Texture" id=26]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=1]
|
||||
shader = ExtResource( 3 )
|
||||
|
@ -515,6 +517,58 @@ tracks/3/keys = {
|
|||
"values": [ 0.0 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=21]
|
||||
resource_name = "ladder_jump"
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Graphics/Sprite:texture")
|
||||
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": [ ExtResource( 26 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Graphics/Sprite:hframes")
|
||||
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": 1,
|
||||
"values": [ 1 ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Graphics/Sprite:frame")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ 0 ]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/path = NodePath("Graphics/Sprite:rotation_degrees")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ 0.0 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=17]
|
||||
resource_name = "push"
|
||||
length = 0.8
|
||||
|
@ -910,6 +964,7 @@ anims/fall = SubResource( 15 )
|
|||
anims/fall_scared = SubResource( 14 )
|
||||
anims/idle = SubResource( 6 )
|
||||
anims/jump = SubResource( 8 )
|
||||
anims/ladder_jump = SubResource( 21 )
|
||||
anims/push = SubResource( 17 )
|
||||
anims/shoot_airborne = SubResource( 11 )
|
||||
anims/shoot_grounded = SubResource( 10 )
|
||||
|
@ -1260,6 +1315,18 @@ script = ExtResource( 8 )
|
|||
wait_time = 20.0
|
||||
autostart = true
|
||||
|
||||
[node name="JumpPeakTimer" type="Timer" parent="."]
|
||||
wait_time = 0.2
|
||||
|
||||
[node name="LowOxygenLabel" type="Label" parent="."]
|
||||
material = ExtResource( 25 )
|
||||
margin_left = -8.0
|
||||
margin_top = -32.0
|
||||
margin_right = 8.0
|
||||
margin_bottom = -18.0
|
||||
theme = ExtResource( 7 )
|
||||
align = 1
|
||||
|
||||
[connection signal="body_entered" from="Hitbox" to="." method="_on_Hitbox_body_entered"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Movement" to="." method="_process_movement"]
|
||||
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded" to="." method="_on_Grounded_state_entered"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue