diff --git a/assets/Audio/SFX/player_attack.wav b/assets/Audio/SFX/player_attack.wav index c7d15ae..e147a7e 100644 Binary files a/assets/Audio/SFX/player_attack.wav and b/assets/Audio/SFX/player_attack.wav differ diff --git a/assets/Audio/SFX/player_attak.wav b/assets/Audio/SFX/player_attak.wav new file mode 100644 index 0000000..54e5fb3 Binary files /dev/null and b/assets/Audio/SFX/player_attak.wav differ diff --git a/assets/Audio/SFX/player_attak.wav.import b/assets/Audio/SFX/player_attak.wav.import new file mode 100644 index 0000000..2d2285c --- /dev/null +++ b/assets/Audio/SFX/player_attak.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/player_attak.wav-e4631e12f4d8c16946f668cc8a2f7b7f.sample" + +[deps] + +source_file="res://assets/Audio/SFX/player_attak.wav" +dest_files=[ "res://.import/player_attak.wav-e4631e12f4d8c16946f668cc8a2f7b7f.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/assets/Audio/SFX/player_dash.wav b/assets/Audio/SFX/player_dash.wav index f7dfe27..c7d15ae 100644 Binary files a/assets/Audio/SFX/player_dash.wav and b/assets/Audio/SFX/player_dash.wav differ diff --git a/assets/Audio/SFX/spike_trap.wav b/assets/Audio/SFX/spike_trap.wav new file mode 100644 index 0000000..6197596 Binary files /dev/null and b/assets/Audio/SFX/spike_trap.wav differ diff --git a/assets/Audio/SFX/spike_trap.wav.import b/assets/Audio/SFX/spike_trap.wav.import new file mode 100644 index 0000000..d83c293 --- /dev/null +++ b/assets/Audio/SFX/spike_trap.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/spike_trap.wav-f53302c3ddefb0b0f57ad30678d3546b.sample" + +[deps] + +source_file="res://assets/Audio/SFX/spike_trap.wav" +dest_files=[ "res://.import/spike_trap.wav-f53302c3ddefb0b0f57ad30678d3546b.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/assets/Audio/SFX/spring.wav b/assets/Audio/SFX/spring.wav new file mode 100644 index 0000000..8657f44 Binary files /dev/null and b/assets/Audio/SFX/spring.wav differ diff --git a/assets/Audio/SFX/spring.wav.import b/assets/Audio/SFX/spring.wav.import new file mode 100644 index 0000000..5cef10a --- /dev/null +++ b/assets/Audio/SFX/spring.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/spring.wav-a38a4871e911a90a2c3beb40a041ae50.sample" + +[deps] + +source_file="res://assets/Audio/SFX/spring.wav" +dest_files=[ "res://.import/spring.wav-a38a4871e911a90a2c3beb40a041ae50.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/src/Actors/Player.gd b/src/Actors/Player.gd index 8c67c91..eb67a34 100644 --- a/src/Actors/Player.gd +++ b/src/Actors/Player.gd @@ -13,6 +13,10 @@ export var wall_jump_speed_factor := Vector2(1 ,.8) export var dash_thrust = 550.0 export var max_wall_slide_gravity := 100.0 +const FLOOR_NORMAL := Vector2.UP +const SNAP_DIRECTION := Vector2.DOWN +const SNAP_LENGTH := 4.0 + var LandingDust = load("res://src/Actors/LandingDust.tscn") var JumpDust = load("res://src/Actors/JumpDust.tscn") var LightBeam = load("res://src/Actors/LightBeam.tscn") @@ -29,6 +33,7 @@ var _can_dash := true var _is_jump_canceled := false var _direction := Vector2.ZERO var _boost_velocity :Vector2 = Vector2.ZERO +var _snap_vector = SNAP_DIRECTION * SNAP_LENGTH var _falling_start_position := .0 @@ -64,7 +69,7 @@ func _physics_process(delta: float) -> void: _input_check() _velocity = calculate_move_velocity(_direction,_is_jump_canceled, delta) _velocity = _boost_velocity if _boost_velocity != Vector2.ZERO else _velocity - _velocity = move_and_slide(_velocity, Vector2.UP) + _velocity = move_and_slide_with_snap(_velocity, _snap_vector if _direction.y != -1 else Vector2.ZERO, FLOOR_NORMAL) _boost_velocity = Vector2.ZERO _check_collisions() update_sprite(_direction) @@ -98,7 +103,7 @@ func _update_state(new_state:int = -1): if _state == States.DASHING: return if _state == States.ATTACKING: return if _state == States.IDLE: - if _velocity.y > 0 and not is_on_floor(): + if (_velocity.y > 0 and not is_on_floor()) or _boost_velocity.y != 0: # Falling from ground new_state = States.IN_AIR elif _state == States.IN_AIR: @@ -132,6 +137,9 @@ func _transition_state(old_state, new_state, auto_update): if old_state == States.WALL_SLIDING: if new_state == States.IDLE: _on_landed() + # if old_state == States.IN_AIR: + # if new_state == States.IDLE: + # print("LANDED!@!!") func _on_landed(): _can_dash = true diff --git a/src/Actors/Player.tscn b/src/Actors/Player.tscn index becc57a..e7058aa 100644 --- a/src/Actors/Player.tscn +++ b/src/Actors/Player.tscn @@ -410,7 +410,7 @@ tracks/4/keys = { "values": [ true ] } -[sub_resource type="Animation" id=12] +[sub_resource type="Animation" id=9] resource_name = "land" length = 0.1 tracks/0/type = "value" @@ -474,7 +474,7 @@ tracks/4/keys = { "values": [ true ] } -[sub_resource type="Animation" id=9] +[sub_resource type="Animation" id=10] length = 0.1 tracks/0/type = "value" tracks/0/path = NodePath("Sprite:frame") @@ -537,7 +537,7 @@ tracks/4/keys = { "values": [ true ] } -[sub_resource type="Animation" id=10] +[sub_resource type="Animation" id=11] length = 0.5 loop = true tracks/0/type = "value" @@ -601,7 +601,7 @@ tracks/4/keys = { "values": [ true ] } -[sub_resource type="Animation" id=11] +[sub_resource type="Animation" id=12] length = 0.3 loop = true tracks/0/type = "value" @@ -715,10 +715,10 @@ anims/die = SubResource( 5 ) anims/fall = SubResource( 6 ) anims/idle = SubResource( 7 ) anims/jump = SubResource( 8 ) -anims/land = SubResource( 12 ) -anims/pre_jump = SubResource( 9 ) -anims/run = SubResource( 10 ) -anims/wall_slide = SubResource( 11 ) +anims/land = SubResource( 9 ) +anims/pre_jump = SubResource( 10 ) +anims/run = SubResource( 11 ) +anims/wall_slide = SubResource( 12 ) [node name="DashTimeout" type="Timer" parent="."] wait_time = 0.12 @@ -743,5 +743,6 @@ cast_to = Vector2( -5.2, 0 ) collision_mask = 8 [node name="Camera" parent="." instance=ExtResource( 4 )] +smoothing_enabled = false [connection signal="body_entered" from="Sprite/SordRange" to="." method="_on_SordRange_body_entered"] [connection signal="timeout" from="DashTimeout" to="." method="_on_DashTimeout_timeout"] diff --git a/src/GameWorld/Levels/Level.gd b/src/GameWorld/Levels/Level.gd index db67fe5..7eabc0d 100644 --- a/src/GameWorld/Levels/Level.gd +++ b/src/GameWorld/Levels/Level.gd @@ -70,12 +70,20 @@ func _set_camera_limits(): func _set_player_position(is_entering:bool): var warps = _get_all_warps() + var found_spawn_point := false + var position = Vector2.ZERO + for warp in warps: if warp.to_level_coord == prev_level: - _player.position = warp.get_checkpoint_position() - _player.face_player(is_entering) - _player.respawn_position = _player.position + position = warp.get_checkpoint_position() + found_spawn_point = true print("Found point warp.position.x = %s player spawn.x = %s" % [warp.position.x, _player.position.x]) + if not found_spawn_point: + position = level_entry_point if is_entering else level_exit_point + + _player.face_player(is_entering) + _player.respawn_position = position + _player.position = position func _set_wrap_zones(): _first_time_init = false diff --git a/src/GameWorld/Levels/PreGame.tscn b/src/GameWorld/Levels/PreGame.tscn index 3a63172..5f286e1 100644 --- a/src/GameWorld/Levels/PreGame.tscn +++ b/src/GameWorld/Levels/PreGame.tscn @@ -270,6 +270,7 @@ to_level_coord = Vector2( 0, 1 ) [node name="SpikeTrap" parent="." instance=ExtResource( 16 )] position = Vector2( 352, 208 ) +direction = 1 [node name="Spring" parent="." instance=ExtResource( 17 )] position = Vector2( 98, 240 ) diff --git a/src/Hazards/SpikeTrap.gd b/src/Hazards/SpikeTrap.gd index 72ee109..279632b 100644 --- a/src/Hazards/SpikeTrap.gd +++ b/src/Hazards/SpikeTrap.gd @@ -12,6 +12,7 @@ func _on_DamageArea_body_entered(body: Node) -> void: func _on_TriggerArea_body_entered(body: Node) -> void: if body.name == "Player" and not triggerd: + AudioManager.play_sfx(AudioManager.Sfx.SPIKE_TRAP) triggerd = true $AnimationPlayer.play("emit") yield($AnimationPlayer, "animation_finished") diff --git a/src/Items/Spring.gd b/src/Items/Spring.gd index 2c77c1a..7c71f51 100644 --- a/src/Items/Spring.gd +++ b/src/Items/Spring.gd @@ -5,5 +5,6 @@ export var thrust:float = 250 func _on_Area2D_body_entered(body: Node) -> void: if body.name == "Player": - body.boost(Vector2(body._velocity.x, -thrust)) + body.boost(Vector2(0, -thrust)) + AudioManager.play_sfx(AudioManager.Sfx.SPRING) $AnimationPlayer.play("activated") diff --git a/src/Singletons/AudioManager.gd b/src/Singletons/AudioManager.gd index bb442ac..3e269ed 100644 --- a/src/Singletons/AudioManager.gd +++ b/src/Singletons/AudioManager.gd @@ -29,7 +29,9 @@ enum Sfx{ PLAYER_ATTACK, PLAYER_DIE, UI_MOVE, - UI_SELECT + UI_SELECT, + SPRING, + SPIKE_TRAP } var _sfx_files := { @@ -39,6 +41,8 @@ var _sfx_files := { Sfx.PLAYER_DASH : load("res://assets/Audio/SFX/player_dash.wav"), Sfx.PLAYER_ATTACK : load("res://assets/Audio/SFX/player_attack.wav"), Sfx.PLAYER_DIE : load("res://assets/Audio/SFX/player_die.wav"), + Sfx.SPRING : load("res://assets/Audio/SFX/spring.wav"), + Sfx.SPIKE_TRAP : load("res://assets/Audio/SFX/spike_trap.wav"), Sfx.UI_MOVE : load("res://assets/Audio/UI_Sounds/menu_move_sound.wav"), Sfx.UI_SELECT : '', }