Move sounds
New task (textures only)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user