Added trailer and ability to disable player
This commit is contained in:
parent
537c85d017
commit
580d0a75fc
7 changed files with 161 additions and 141 deletions
BIN
.DS_Store
vendored
BIN
.DS_Store
vendored
Binary file not shown.
|
@ -48,145 +48,147 @@ func _ready():
|
||||||
menuScene.visible = false
|
menuScene.visible = false
|
||||||
|
|
||||||
func _unhandled_input(event):
|
func _unhandled_input(event):
|
||||||
if is_multiplayer_authority():
|
if not Global.playerDisable:
|
||||||
Global.selfTeddy = selfTeddy
|
if is_multiplayer_authority():
|
||||||
if event is InputEventMouseButton:
|
Global.selfTeddy = selfTeddy
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
if event is InputEventMouseButton:
|
||||||
elif event.is_action_pressed("ui_cancel"):
|
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
|
||||||
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
|
||||||
mousesense = Global.mouseSensitivity
|
|
||||||
if event is InputEventMouseMotion:
|
|
||||||
neck.rotate_y(-event.relative.x * mousesense)
|
|
||||||
camera.rotate_x(-event.relative.y * mousesense)
|
|
||||||
## FOR CONTROLLERS
|
|
||||||
if event is InputEventJoypadMotion:
|
|
||||||
var cam_dir = Input.is_action_pressed("cam_left") or Input.is_action_pressed("cam_right") or Input.is_action_pressed("cam_up") or Input.is_action_pressed("cam_down")
|
|
||||||
if cam_dir:
|
|
||||||
controllerAxisValue_x = -event.get_axis_value() * mousesense
|
|
||||||
controllerAxisValue_y = -event.get_axis_value() * mousesense
|
|
||||||
##################
|
|
||||||
|
|
||||||
# Clamps the camera
|
|
||||||
camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-90), deg_to_rad(90))
|
|
||||||
if Input.is_action_just_pressed("menu"):
|
|
||||||
if menuScene.visible == false:
|
|
||||||
menuScene.visible = true
|
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
|
||||||
elif menuScene.visible == true:
|
|
||||||
menuScene.visible = false
|
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||||
|
elif event.is_action_pressed("ui_cancel"):
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||||
|
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
||||||
|
mousesense = Global.mouseSensitivity
|
||||||
|
if event is InputEventMouseMotion:
|
||||||
|
neck.rotate_y(-event.relative.x * mousesense)
|
||||||
|
camera.rotate_x(-event.relative.y * mousesense)
|
||||||
|
## FOR CONTROLLERS
|
||||||
|
if event is InputEventJoypadMotion:
|
||||||
|
var cam_dir = Input.is_action_pressed("cam_left") or Input.is_action_pressed("cam_right") or Input.is_action_pressed("cam_up") or Input.is_action_pressed("cam_down")
|
||||||
|
if cam_dir:
|
||||||
|
controllerAxisValue_x = -event.get_axis_value() * mousesense
|
||||||
|
controllerAxisValue_y = -event.get_axis_value() * mousesense
|
||||||
|
##################
|
||||||
|
|
||||||
|
# Clamps the camera
|
||||||
|
camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-90), deg_to_rad(90))
|
||||||
|
if Input.is_action_just_pressed("menu"):
|
||||||
|
if menuScene.visible == false:
|
||||||
|
menuScene.visible = true
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||||
|
elif menuScene.visible == true:
|
||||||
|
menuScene.visible = false
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
if is_multiplayer_authority():
|
if not Global.playerDisable:
|
||||||
# This variable gets set my the death scene, so we know the player needs to be respawned
|
if is_multiplayer_authority():
|
||||||
if Global.playerPleaseRespawn == true:
|
# This variable gets set my the death scene, so we know the player needs to be respawned
|
||||||
get_node(teddyCollider).disabled = false
|
if Global.playerPleaseRespawn == true:
|
||||||
var ramMax = Global.spawnCoords_x.size() - 1
|
get_node(teddyCollider).disabled = false
|
||||||
var ramnum = RandomNumberGenerator.new().randi_range(0, ramMax)
|
var ramMax = Global.spawnCoords_x.size() - 1
|
||||||
print("ramnum: ", ramnum)
|
var ramnum = RandomNumberGenerator.new().randi_range(0, ramMax)
|
||||||
print("ramMax: ", ramMax)
|
print("ramnum: ", ramnum)
|
||||||
position.x = Global.spawnCoords_x[ramnum] #Set player X
|
print("ramMax: ", ramMax)
|
||||||
position.y = Global.spawnCoords_y[ramnum] #Set player Y
|
position.x = Global.spawnCoords_x[ramnum] #Set player X
|
||||||
position.z = Global.spawnCoords_z[ramnum] #Set player Z
|
position.y = Global.spawnCoords_y[ramnum] #Set player Y
|
||||||
await get_tree().create_timer(0.5).timeout
|
position.z = Global.spawnCoords_z[ramnum] #Set player Z
|
||||||
Global.reset_variables()
|
await get_tree().create_timer(0.5).timeout
|
||||||
ranRemovePlayer = false
|
Global.reset_variables()
|
||||||
rpc("teddy_dead_nomore")
|
ranRemovePlayer = false
|
||||||
|
rpc("teddy_dead_nomore")
|
||||||
|
|
||||||
## If player falls off the map, kill them!
|
## If player falls off the map, kill them!
|
||||||
if velocity.y < Global.playerYDeath:
|
if velocity.y < Global.playerYDeath:
|
||||||
Global.playerHealth = 0
|
Global.playerHealth = 0
|
||||||
if Global.playerHealth <= 0:
|
if Global.playerHealth <= 0:
|
||||||
Global.player_dead()
|
Global.player_dead()
|
||||||
|
|
||||||
if ranRemovePlayer == false:
|
if ranRemovePlayer == false:
|
||||||
if Global.playerAlive == false:
|
if Global.playerAlive == false:
|
||||||
ranRemovePlayer = true
|
ranRemovePlayer = true
|
||||||
get_node(teddyCollider).disabled = true
|
get_node(teddyCollider).disabled = true
|
||||||
rpc("remove_dead_teddy")
|
rpc("remove_dead_teddy")
|
||||||
|
|
||||||
if Global.playerAlive:
|
if Global.playerAlive:
|
||||||
# Add the gravity.
|
# Add the gravity.
|
||||||
if not is_on_floor():
|
if not is_on_floor():
|
||||||
velocity.y -= gravity * delta
|
velocity.y -= gravity * delta
|
||||||
# Handle Jump.
|
# Handle Jump.
|
||||||
if Input.is_action_just_pressed("jump") and is_on_floor():
|
if Input.is_action_just_pressed("jump") and is_on_floor():
|
||||||
velocity.y = JUMP_VELOCITY
|
velocity.y = JUMP_VELOCITY
|
||||||
var cam_dir = Input.is_action_pressed("cam_left") or Input.is_action_pressed("cam_right") or Input.is_action_pressed("cam_up") or Input.is_action_pressed("cam_down")
|
var cam_dir = Input.is_action_pressed("cam_left") or Input.is_action_pressed("cam_right") or Input.is_action_pressed("cam_up") or Input.is_action_pressed("cam_down")
|
||||||
if cam_dir:
|
if cam_dir:
|
||||||
if Input.is_action_pressed("cam_left"):
|
if Input.is_action_pressed("cam_left"):
|
||||||
controllerAxisValue_x += 1 * mousesense
|
controllerAxisValue_x += 1 * mousesense
|
||||||
if Input.is_action_pressed("cam_right"):
|
if Input.is_action_pressed("cam_right"):
|
||||||
controllerAxisValue_x -= 1 * mousesense
|
controllerAxisValue_x -= 1 * mousesense
|
||||||
if Input.is_action_pressed("cam_up"):
|
if Input.is_action_pressed("cam_up"):
|
||||||
controllerAxisValue_y += 1 * mousesense
|
controllerAxisValue_y += 1 * mousesense
|
||||||
if Input.is_action_pressed("cam_down"):
|
if Input.is_action_pressed("cam_down"):
|
||||||
controllerAxisValue_y -= 1 * mousesense
|
controllerAxisValue_y -= 1 * mousesense
|
||||||
neck.rotate_y(controllerAxisValue_x)
|
neck.rotate_y(controllerAxisValue_x)
|
||||||
camera.rotate_x(controllerAxisValue_y)
|
camera.rotate_x(controllerAxisValue_y)
|
||||||
else:
|
else:
|
||||||
controllerAxisValue_x = 0
|
controllerAxisValue_x = 0
|
||||||
controllerAxisValue_y = 0
|
controllerAxisValue_y = 0
|
||||||
var input_dir = Input.get_vector("player_left", "player_right", "player_forward", "player_backward")
|
var input_dir = Input.get_vector("player_left", "player_right", "player_forward", "player_backward")
|
||||||
var direction = (neck.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
var direction = (neck.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||||
if input_dir:
|
if input_dir:
|
||||||
if not Input.is_action_pressed("sprint"):
|
if not Input.is_action_pressed("sprint"):
|
||||||
rpc("teddy_play_anim", "walk")
|
rpc("teddy_play_anim", "walk")
|
||||||
else:
|
else:
|
||||||
rpc("teddy_play_anim", "idle")
|
rpc("teddy_play_anim", "idle")
|
||||||
if Input.is_action_pressed("sprint"):
|
if Input.is_action_pressed("sprint"):
|
||||||
if Global.fatigue > 5:
|
if Global.fatigue > 5:
|
||||||
speed = SPEED * 2
|
speed = SPEED * 2
|
||||||
if Global.fatigue < 5:
|
if Global.fatigue < 5:
|
||||||
speed = SPEED
|
speed = SPEED
|
||||||
if Input.is_action_pressed("sprint"):
|
if Input.is_action_pressed("sprint"):
|
||||||
rpc("teddy_play_anim", "run")
|
rpc("teddy_play_anim", "run")
|
||||||
elif Global.fatigue > 5:
|
elif Global.fatigue > 5:
|
||||||
speed = SPEED
|
speed = SPEED
|
||||||
if Input.is_action_just_released("sprint"):
|
if Input.is_action_just_released("sprint"):
|
||||||
speed = SPEED
|
speed = SPEED
|
||||||
if direction:
|
if direction:
|
||||||
velocity.x = direction.x * speed
|
velocity.x = direction.x * speed
|
||||||
velocity.z = direction.z * speed
|
velocity.z = direction.z * speed
|
||||||
else:
|
else:
|
||||||
velocity.x = move_toward(velocity.x, 0, speed)
|
velocity.x = move_toward(velocity.x, 0, speed)
|
||||||
velocity.z = move_toward(velocity.z, 0, speed)
|
velocity.z = move_toward(velocity.z, 0, speed)
|
||||||
if Global.playerDead:
|
if Global.playerDead:
|
||||||
velocity.x = 0
|
velocity.x = 0
|
||||||
velocity.z = 0
|
velocity.z = 0
|
||||||
if Input.is_action_just_pressed("shoot") and Global.roundInSession and menuScene.visible == false:
|
if Input.is_action_just_pressed("shoot") and Global.roundInSession and menuScene.visible == false:
|
||||||
if menuOpen == false:
|
if menuOpen == false:
|
||||||
if Global.multiplayerCurrent == true:
|
if Global.multiplayerCurrent == true:
|
||||||
rpc("shoot_bullet")
|
rpc("shoot_bullet")
|
||||||
shoot_bullet()
|
shoot_bullet()
|
||||||
else:
|
else:
|
||||||
shoot_bullet()
|
shoot_bullet()
|
||||||
if Input.is_action_just_pressed("console"):
|
if Input.is_action_just_pressed("console"):
|
||||||
var scene_trs = load("res://scenes/console.tscn")
|
var scene_trs = load("res://scenes/console.tscn")
|
||||||
var scene = scene_trs.instantiate()
|
var scene = scene_trs.instantiate()
|
||||||
if not Global.consoleOpen:
|
if not Global.consoleOpen:
|
||||||
Global.consoleOpen = true
|
Global.consoleOpen = true
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||||
add_child(scene)
|
add_child(scene)
|
||||||
elif Global.consoleOpen:
|
elif Global.consoleOpen:
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||||
Global.consoleOpen = false # We remove the scene in console.gd
|
Global.consoleOpen = false # We remove the scene in console.gd
|
||||||
if Global.roundInSession == false:
|
if Global.roundInSession == false:
|
||||||
if teddyAuthority == 1:
|
|
||||||
if Global.HUDStartLabelText == "":
|
|
||||||
Global.HUDStartLabelText = "PRESS ENTER/RETURN TO START THE ROUND"
|
|
||||||
if Input.is_action_just_pressed("start_game"):
|
|
||||||
if teddyAuthority == 1:
|
if teddyAuthority == 1:
|
||||||
Global.roundInSession = true
|
if Global.HUDStartLabelText == "":
|
||||||
rpc("round_start")
|
Global.HUDStartLabelText = "PRESS ENTER/RETURN TO START THE ROUND"
|
||||||
if Global.spawnCotton == true:
|
if Input.is_action_just_pressed("start_game"):
|
||||||
Global.spawnCotton = false
|
if teddyAuthority == 1:
|
||||||
rpc("spawn_cotton")
|
Global.roundInSession = true
|
||||||
spawn_cotton()
|
rpc("round_start")
|
||||||
rpc("remote_set_position", global_position, $CollisionShape3D/Neck/Teddy.global_rotation.y, $CollisionShape3D/Neck/Camera3D/BulletGenerator.global_position, $CollisionShape3D/Neck/Camera3D/BulletGenerator.global_rotation)
|
if Global.spawnCotton == true:
|
||||||
rpc("set_teddy_name", teddyName, Global.playerName)
|
Global.spawnCotton = false
|
||||||
move_and_slide()
|
rpc("spawn_cotton")
|
||||||
|
spawn_cotton()
|
||||||
|
rpc("remote_set_position", global_position, $CollisionShape3D/Neck/Teddy.global_rotation.y, $CollisionShape3D/Neck/Camera3D/BulletGenerator.global_position, $CollisionShape3D/Neck/Camera3D/BulletGenerator.global_rotation)
|
||||||
|
rpc("set_teddy_name", teddyName, Global.playerName)
|
||||||
|
move_and_slide()
|
||||||
|
|
||||||
@rpc("any_peer", "unreliable")
|
@rpc("any_peer", "unreliable")
|
||||||
func remote_set_position(authority_position, teddy_rotation, bulletgenerator_position, bulletgenerator_rotation):
|
func remote_set_position(authority_position, teddy_rotation, bulletgenerator_position, bulletgenerator_rotation):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=10 format=3 uid="uid://dkokyp5lwhks4"]
|
[gd_scene load_steps=11 format=3 uid="uid://dkokyp5lwhks4"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/maps/tutorial.gd" id="1_40ws8"]
|
[ext_resource type="Script" path="res://scripts/maps/tutorial.gd" id="1_40ws8"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dp1q51kvd8uow" path="res://scenes/Teddy.tscn" id="1_081si"]
|
[ext_resource type="PackedScene" uid="uid://dp1q51kvd8uow" path="res://scenes/Teddy.tscn" id="1_081si"]
|
||||||
|
@ -6,6 +6,7 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://y3fffh5cdbks" path="res://scenes/AI.tscn" id="4_fttoe"]
|
[ext_resource type="PackedScene" uid="uid://y3fffh5cdbks" path="res://scenes/AI.tscn" id="4_fttoe"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c1y6p4m0sktfj" path="res://scenes/farmland-map.tscn" id="5_imhi6"]
|
[ext_resource type="PackedScene" uid="uid://c1y6p4m0sktfj" path="res://scenes/farmland-map.tscn" id="5_imhi6"]
|
||||||
[ext_resource type="PackedScene" uid="uid://buyvavyuwmccw" path="res://joystick/virtual_joystick.tscn" id="6_p8th3"]
|
[ext_resource type="PackedScene" uid="uid://buyvavyuwmccw" path="res://joystick/virtual_joystick.tscn" id="6_p8th3"]
|
||||||
|
[ext_resource type="VideoStream" path="res://videos/trailer.ogv" id="7_4deue"]
|
||||||
|
|
||||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_i5hsu"]
|
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_i5hsu"]
|
||||||
sky_top_color = Color(1, 1, 1, 1)
|
sky_top_color = Color(1, 1, 1, 1)
|
||||||
|
@ -42,3 +43,12 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.21775, 1.22338, -28.4151)
|
||||||
[node name="Farmland" parent="." instance=ExtResource("5_imhi6")]
|
[node name="Farmland" parent="." instance=ExtResource("5_imhi6")]
|
||||||
|
|
||||||
[node name="Virtual joystick" parent="." instance=ExtResource("6_p8th3")]
|
[node name="Virtual joystick" parent="." instance=ExtResource("6_p8th3")]
|
||||||
|
|
||||||
|
[node name="VideoStreamPlayer" type="VideoStreamPlayer" parent="."]
|
||||||
|
offset_right = 1152.0
|
||||||
|
offset_bottom = 648.0
|
||||||
|
mouse_filter = 2
|
||||||
|
mouse_force_pass_scroll_events = false
|
||||||
|
stream = ExtResource("7_4deue")
|
||||||
|
autoplay = true
|
||||||
|
expand = true
|
||||||
|
|
|
@ -31,11 +31,12 @@ func _process(delta):
|
||||||
restart_round()
|
restart_round()
|
||||||
rpc("restart_round")
|
rpc("restart_round")
|
||||||
if Global.mapName == "Tutorial":
|
if Global.mapName == "Tutorial":
|
||||||
tutorial()
|
if not Global.playerDisable:
|
||||||
if not Global.tutorialComplete:
|
tutorial()
|
||||||
$musicPanel.visible = false
|
if not Global.tutorialComplete:
|
||||||
if Global.iAmSpecial and Global.gamemode == "Runner":
|
$musicPanel.visible = false
|
||||||
rpc("sync_runner_hp", $Health.value)
|
if Global.iAmSpecial and Global.gamemode == "Runner":
|
||||||
|
rpc("sync_runner_hp", $Health.value)
|
||||||
if Global.musicUpdated == true:
|
if Global.musicUpdated == true:
|
||||||
Global.musicUpdated = false
|
Global.musicUpdated = false
|
||||||
$musicPanel/playingLabel.text = Global.musicName
|
$musicPanel/playingLabel.text = Global.musicName
|
||||||
|
|
|
@ -48,6 +48,7 @@ var iAmDeadAndInnocent = false # Used to keep track of when an innocent dies in
|
||||||
var spawnCotton = false # bullet will change this to true
|
var spawnCotton = false # bullet will change this to true
|
||||||
var addedMenuScene = false # Used for teddy.gd, fixes multiple menu bug
|
var addedMenuScene = false # Used for teddy.gd, fixes multiple menu bug
|
||||||
var tutorialCompleted = false # Used in the save file, to know if a play should go to tutorial first
|
var tutorialCompleted = false # Used in the save file, to know if a play should go to tutorial first
|
||||||
|
var playerDisable = false # Can be used to disable the player
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
#if not spawnCoordsInitalized:
|
#if not spawnCoordsInitalized:
|
||||||
|
|
|
@ -11,6 +11,12 @@ func _ready():
|
||||||
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
|
if Input.is_action_just_released("menu"):
|
||||||
|
$VideoStreamPlayer.stop()
|
||||||
|
if $VideoStreamPlayer.is_playing():
|
||||||
|
Global.playerDisable = true
|
||||||
|
else:
|
||||||
|
Global.playerDisable = false
|
||||||
if Global.tutorialComplete:
|
if Global.tutorialComplete:
|
||||||
if audio_stream_player.playing == false:
|
if audio_stream_player.playing == false:
|
||||||
var randomnum = RandomNumberGenerator.new().randi_range(0, 6)
|
var randomnum = RandomNumberGenerator.new().randi_range(0, 6)
|
||||||
|
|
BIN
videos/trailer.ogv
Normal file
BIN
videos/trailer.ogv
Normal file
Binary file not shown.
Loading…
Reference in a new issue