Move sounds

New task (textures only)
This commit is contained in:
2020-10-05 16:37:57 +02:00
parent ace4593b46
commit c623d6d168
17 changed files with 372 additions and 68 deletions

View File

@@ -0,0 +1,13 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
valid=false
[deps]
source_file="res://Characters/Player/Aimo/explosion.ogg"
[params]
loop=true
loop_offset=0

Binary file not shown.

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=19 format=2]
[gd_scene load_steps=21 format=2]
[ext_resource path="res://Characters/Player/player.gd" type="Script" id=1]
[ext_resource path="res://Characters/Player/Bit/Idle_01.png" type="Texture" id=2]
@@ -14,6 +14,7 @@
[ext_resource path="res://Characters/Player/Bit/Run_06.png" type="Texture" id=12]
[ext_resource path="res://Lightmaps/PlayerLight.png" type="Texture" id=13]
[ext_resource path="res://Lightmaps/CompleteWhite.png" type="Texture" id=14]
[ext_resource path="res://Sounds/Concrete Steps.ogg" type="AudioStream" id=15]
[sub_resource type="CapsuleShape2D" id=1]
radius = 11.2128
@@ -38,10 +39,13 @@ animations = [ {
} ]
[sub_resource type="CircleShape2D" id=3]
radius = 121.239
radius = 197.889
[sub_resource type="CircleShape2D" id=4]
radius = 139.247
radius = 227.776
[sub_resource type="CircleShape2D" id=5]
radius = 19.982
[node name="Player" type="KinematicBody2D"]
position = Vector2( 0.377872, 0.100608 )
@@ -49,7 +53,7 @@ script = ExtResource( 1 )
__meta__ = {
"_edit_group_": true
}
BASE_CAMERA_ZOOM = 0.4
BASE_CAMERA_ZOOM = 0.6
VIEW_SMOOTH_FACTOR = 0.1
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
@@ -62,7 +66,6 @@ shape = SubResource( 1 )
position = Vector2( -1.21067, 0.601201 )
frames = SubResource( 2 )
animation = "idle"
frame = 1
playing = true
[node name="Label" type="Label" parent="."]
@@ -80,7 +83,7 @@ __meta__ = {
position = Vector2( -0.495953, 13.2623 )
z_index = 2
texture = ExtResource( 13 )
texture_scale = 0.95
texture_scale = 1.6
energy = 0.7
shadow_enabled = true
shadow_filter = 4
@@ -93,6 +96,11 @@ energy = 0.7
mode = 1
shadow_filter = 2
[node name="ConcreteSteps" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 15 )
max_distance = 200.0
attenuation = 5.09823
[node name="View" type="Area2D" parent="."]
modulate = Color( 0.192157, 0.239216, 0.713726, 1 )
@@ -106,5 +114,10 @@ modulate = Color( 0.658824, 0.984314, 0.227451, 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Receive"]
modulate = Color( 0.439216, 0.427451, 0.427451, 1 )
shape = SubResource( 4 )
[node name="Kill" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Kill"]
shape = SubResource( 5 )
[connection signal="body_entered" from="View" to="." method="_on_Area2D_body_entered"]
[connection signal="body_exited" from="View" to="." method="_on_Area2D_body_exited"]

View File

@@ -24,6 +24,13 @@ var look_direction = Vector2(1, 0)
var minimap = false
var zoom_interpolation = 0
# True if step sound is playing
var sound_playing = false
# Contains id of the underlying tile
# 0: Office Concrete
# 1: Office Concrete 2
var current_ground = 0
# Get camara
onready var camera_focus = $"/root/Node2D/Game/Focus" as Position2D
onready var camera = $"/root/Node2D/Game/Focus/Camera" as Camera2D
@@ -60,8 +67,17 @@ func _physics_process(delta):
# Put focus on player if not in minimap
var start = Vector2(BASE_CAMERA_ZOOM, BASE_CAMERA_ZOOM)
var end = Vector2(1.5, 1.5)
if $Kill.get_overlapping_bodies().size() > 1:
($"/root/Node2D/GUI/Game/Kill" as Button).disabled = false
else:
($"/root/Node2D/GUI/Game/Kill" as Button).disabled = true
# Camera movement
if !minimap:
camera_focus.position = position
if is_network_master():
camera_focus.position = position
if zoom_interpolation <= 1.1:
zoom_interpolation -= 0.05
camera.set_zoom(start.cubic_interpolate(end, start/2, end/2, zoom_interpolation))
@@ -88,7 +104,6 @@ func _physics_process(delta):
"""
MOVEMENT
"""
var direction = MoveDirection.NONE
var RIGHT = Input.is_action_pressed("ui_right")
@@ -131,6 +146,11 @@ func _physics_process(delta):
Networking.update_position(int(name), position)
func _move(direction):
if direction != MoveDirection.NONE:
play_step()
else:
$ConcreteSteps.stop()
match direction:
MoveDirection.NONE:
return
@@ -156,3 +176,8 @@ func _move(direction):
velocity.x = MOVE_SPEED*RUN_MULTIPLIER
else:
velocity.x = MOVE_SPEED
func play_step():
if !$ConcreteSteps.playing:
$ConcreteSteps.play()
sound_playing = true