This commit is contained in:
Victor Turgeon 2022-10-12 10:13:46 -04:00
commit d053eca147
13 changed files with 242 additions and 65 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ export_presets.cfg
.mono/
data_*/
assets/uploads_files_2736715_Mars.obj
First Person Slapper

BIN
Audio/whoosh.wav Normal file

Binary file not shown.

23
Audio/whoosh.wav.import Normal file
View File

@ -0,0 +1,23 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/whoosh.wav-3f78e56f3c095630fbe6defec4c28484.sample"
[deps]
source_file="res://Audio/whoosh.wav"
dest_files=[ "res://.import/whoosh.wav-3f78e56f3c095630fbe6defec4c28484.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_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -1,9 +1,10 @@
[gd_scene load_steps=10 format=2]
[gd_scene load_steps=11 format=2]
[ext_resource path="res://SlapGauge.gd" type="Script" id=1]
[ext_resource path="res://Start.gd" type="Script" id=2]
[ext_resource path="res://fonts/TorontoSubwayRegular.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://Audio/menumusic.ogg" type="AudioStream" id=4]
[ext_resource path="res://Options.gd" type="Script" id=5]
[sub_resource type="DynamicFont" id=4]
size = 19
@ -106,21 +107,20 @@ text = "Slap"
[node name="MenuLayer" type="CanvasLayer" parent="."]
layer = 2
[node name="Start" type="Control" parent="MenuLayer"]
pause_mode = 2
visible = false
margin_right = 40.0
margin_bottom = 40.0
theme = SubResource( 8 )
script = ExtResource( 2 )
[node name="Background" type="ColorRect" parent="MenuLayer/Start"]
[node name="Background" type="ColorRect" parent="MenuLayer"]
margin_left = -4.0
margin_top = -8.0
margin_right = 1927.0
margin_bottom = 1085.0
color = Color( 0.14902, 0.121569, 0.121569, 1 )
[node name="Start" type="Control" parent="MenuLayer"]
pause_mode = 2
margin_right = 40.0
margin_bottom = 40.0
theme = SubResource( 8 )
script = ExtResource( 2 )
[node name="Title" type="Label" parent="MenuLayer/Start"]
margin_left = 532.0
margin_top = 353.0
@ -153,7 +153,86 @@ text = "Quit Game"
[node name="MenuMusic" type="AudioStreamPlayer" parent="MenuLayer/Start"]
stream = ExtResource( 4 )
volume_db = 3.0
bus = "Music"
[node name="Options" type="Control" parent="MenuLayer/Start"]
margin_right = 40.0
margin_bottom = 40.0
theme = SubResource( 8 )
script = ExtResource( 5 )
[node name="MouseSensSlider" type="HSlider" parent="MenuLayer/Start/Options"]
margin_left = 1428.0
margin_top = 530.0
margin_right = 1755.0
margin_bottom = 562.0
rect_pivot_offset = Vector2( 199, 32 )
max_value = 0.5
step = 0.05
[node name="MousSensLbl" type="Label" parent="MenuLayer/Start/Options/MouseSensSlider"]
margin_left = -155.0
margin_top = 4.0
margin_right = -16.0
margin_bottom = 27.0
text = "Mouse Sensitivity"
[node name="SFXSlider" type="HSlider" parent="MenuLayer/Start/Options"]
margin_left = 1428.0
margin_top = 572.0
margin_right = 1755.0
margin_bottom = 604.0
rect_pivot_offset = Vector2( 199, 32 )
max_value = 1.2
step = 0.05
[node name="SFXSlider" type="Label" parent="MenuLayer/Start/Options/SFXSlider"]
margin_left = -117.0
margin_top = 5.0
margin_right = -18.0
margin_bottom = 27.0
text = "SFX Volume"
[node name="MusicSlider" type="HSlider" parent="MenuLayer/Start/Options"]
margin_left = 1428.0
margin_top = 612.0
margin_right = 1755.0
margin_bottom = 644.0
rect_pivot_offset = Vector2( -414, 50 )
max_value = 1.2
step = 0.05
[node name="MusicLbl" type="Label" parent="MenuLayer/Start/Options/MusicSlider"]
margin_left = -133.0
margin_top = 5.0
margin_right = -18.0
margin_bottom = 27.0
text = "Music Volume"
[node name="MasterVolSlider" type="HSlider" parent="MenuLayer/Start/Options"]
margin_left = 1428.0
margin_top = 654.0
margin_right = 1755.0
margin_bottom = 686.0
rect_pivot_offset = Vector2( -414, 50 )
max_value = 1.2
step = 0.05
[node name="MasterLbl" type="Label" parent="MenuLayer/Start/Options/MasterVolSlider"]
margin_left = -143.0
margin_top = 4.0
margin_right = -17.0
margin_bottom = 26.0
text = "Master Volume"
[connection signal="pressed" from="MenuLayer/Start/New Game" to="MenuLayer/Start" method="_on_New_Game_pressed"]
[connection signal="pressed" from="MenuLayer/Start/Quit to Desktop" to="MenuLayer/Start" method="_on_Quit_to_Desktop_Button_pressed"]
[connection signal="pressed" from="MenuLayer/Start/Quit Game" to="MenuLayer/Start" method="_on_Quit_Game_pressed"]
[connection signal="mouse_exited" from="MenuLayer/Start/Options/MouseSensSlider" to="MenuLayer/Start/Options" method="_on_MouseSensSlider_mouse_exited"]
[connection signal="value_changed" from="MenuLayer/Start/Options/MouseSensSlider" to="MenuLayer/Start/Options" method="_on_MouseSensSlider_value_changed"]
[connection signal="mouse_exited" from="MenuLayer/Start/Options/SFXSlider" to="MenuLayer/Start/Options" method="_on_SFXSlider_mouse_exited"]
[connection signal="value_changed" from="MenuLayer/Start/Options/SFXSlider" to="MenuLayer/Start/Options" method="_on_SFXSlider_value_changed"]
[connection signal="mouse_exited" from="MenuLayer/Start/Options/MusicSlider" to="MenuLayer/Start/Options" method="_on_MusicSlider_mouse_exited"]
[connection signal="value_changed" from="MenuLayer/Start/Options/MusicSlider" to="MenuLayer/Start/Options" method="_on_MusicSlider_value_changed"]
[connection signal="mouse_exited" from="MenuLayer/Start/Options/MasterVolSlider" to="MenuLayer/Start/Options" method="_on_MasterVolSlider_mouse_exited"]
[connection signal="value_changed" from="MenuLayer/Start/Options/MasterVolSlider" to="MenuLayer/Start/Options" method="_on_MasterVolSlider_value_changed"]

60
Options.gd Normal file
View File

@ -0,0 +1,60 @@
extends Control
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var MouseSensSlider = $MouseSensSlider
onready var SFXVol = $SFXSlider
onready var MusicVol = $MusicSlider
onready var MasterVol = $MasterVolSlider
onready var SFXBusName := "SFX"
onready var MusicBusName := "Music"
onready var MasterBusName := "Master"
onready var SFXBus := AudioServer.get_bus_index(SFXBusName)
onready var MusicBus := AudioServer.get_bus_index(MusicBusName)
onready var MasterBus := AudioServer.get_bus_index(MasterBusName)
# Called when the node enters the scene tree for the first time.
func _ready():
MouseSensSlider.value = get_node("/root/Spatial/Player").mouse_sensitivity
SFXVol.value = db2linear(AudioServer.get_bus_volume_db(SFXBus))
MusicVol.value = db2linear(AudioServer.get_bus_volume_db(MusicBus))
MasterVol.value = db2linear(AudioServer.get_bus_volume_db(MasterBus))
func _on_MouseSensSlider_value_changed(value):
get_node("/root/Spatial/Player").mouse_sensitivity = value
func _on_SFXSlider_value_changed(value):
AudioServer.set_bus_volume_db(SFXBus, linear2db(value))
func _on_MusicSlider_value_changed(value):
AudioServer.set_bus_volume_db(MusicBus, linear2db(value))
func _on_MasterVolSlider_value_changed(value):
AudioServer.set_bus_volume_db(MasterBus, linear2db(value))
func _on_MouseSensSlider_mouse_exited():
pass#MouseSensSlider.release_focus()
func _on_SFXSlider_mouse_exited():
pass#SFXVol.release_focus()
func _on_MusicSlider_mouse_exited():
pass#MusicVol.release_focus()
func _on_MasterVolSlider_mouse_exited():
pass#MasterVol.release_focus()

View File

@ -32,11 +32,10 @@ onready var ground_check = $GroundCheck
onready var slap_gauge = $HUD/PlayerLayer/ActualHUD/SlapGauge
onready var slap_animator = $HandMovement
onready var Menu = $HUD/MenuLayer/Start
onready var AudioSlap = $AudioSlap
onready var AudioMegaSlap = $AudioMegaSlap
onready var hitbox = $Head/Camera/HitBox
onready var slap_cooldown = $SlapCooldown
onready var AudioCharge = $AudioCharge
onready var Whoosh = $AudioWhoosh
onready var Music = $Music
onready var Steps = [ $Step1, $Step2, $Step3, $Step4 ]
var rng = RandomNumberGenerator.new()
@ -44,6 +43,7 @@ var rng = RandomNumberGenerator.new()
func _ready():
rng.randomize()
slap_animator.current_animation = "basic_slap"
slap_animator.playback_speed = 30
func _input(event):
@ -107,26 +107,15 @@ func _physics_process(delta):
chargeSlap = true;
elif Input.is_action_just_released("slap"):
if chargeSlap:
isSlap = true;
chargeSlap = false;
isSlap = true
Whoosh.play()
chargeSlap = false
can_slap = false
slap_cooldown.start(0.25)
AudioCharge.stop();
else:
isSlap = false;
if isSlap:
if slap >= slapkill:
AudioMegaSlap.play()
else:
AudioSlap.play()
isSlap = false;
hitbox.monitorable = true
hitbox.slap_level = slap
hitbox.slap_kill = slapkill
hitbox.slap_vector = point_to.get_global_transform().origin - camera.get_global_transform().origin
if (chargeSlap):
slap += delta * 1.5;
else:
@ -134,11 +123,19 @@ func _physics_process(delta):
slap = clamp(slap, 0.0, 1.0)
slap_gauge.fill = slap
slap_animator.seek(slap, true)
if !isSlap and can_slap:
slap_animator.seek(slap, true)
if isSlap:
slap_animator.play()
slap_gauge.fill = slap;
slap_gauge.kill = slapkill;
if isSlap:
isSlap = false;
hitbox.monitorable = true
hitbox.slap_level = slap
hitbox.slap_kill = slapkill
hitbox.slap_vector = point_to.get_global_transform().origin - camera.get_global_transform().origin
direction = direction.normalized()
if isStep:
@ -155,8 +152,6 @@ func _physics_process(delta):
movement.x = h_velocity.x + gravity_vec.x
movement.y = gravity_vec.y
# warning-ignore:return_value_discarded
move_and_slide(movement, Vector3.UP)

View File

@ -1,11 +1,10 @@
[gd_scene load_steps=21 format=2]
[gd_scene load_steps=20 format=2]
[ext_resource path="res://Player.gd" type="Script" id=1]
[ext_resource path="res://BlenderStuff/Hand/protohand.obj" type="ArrayMesh" id=2]
[ext_resource path="res://Textures/kenney_prototype_textures/purple/texture_01.png" type="Texture" id=3]
[ext_resource path="res://HUD.tscn" type="PackedScene" id=4]
[ext_resource path="res://Audio/80-s-clap.wav" type="AudioStream" id=5]
[ext_resource path="res://Audio/MegaSlap.wav" type="AudioStream" id=6]
[ext_resource path="res://Audio/whoosh.wav" type="AudioStream" id=5]
[ext_resource path="res://Scripts/HitBox.gd" type="Script" id=7]
[ext_resource path="res://Audio/step2.wav" type="AudioStream" id=8]
[ext_resource path="res://Audio/step3.wav" type="AudioStream" id=9]
@ -69,6 +68,7 @@ tracks/2/keys = {
[sub_resource type="Animation" id=6]
resource_name = "basic_slap"
length = 3.0
tracks/0/type = "value"
tracks/0/path = NodePath("Head/HandParent/Hand:translation")
tracks/0/interp = 1
@ -76,10 +76,10 @@ tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ),
"times": PoolRealArray( 0, 1, 2, 3 ),
"transitions": PoolRealArray( 1, 0.258816, 1, 1 ),
"update": 0,
"values": [ Vector3( 0, 0, 0 ), Vector3( -0.103, 2.756, 0 ) ]
"values": [ Vector3( 0, 0, 0 ), Vector3( -0.103, 2.756, -0.5 ), Vector3( 0, -3, -3 ), Vector3( 0, 0, 0 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Head/HandParent/Hand:rotation_degrees")
@ -88,10 +88,10 @@ tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ),
"times": PoolRealArray( 0, 1, 2, 3 ),
"transitions": PoolRealArray( 1, 1, 0.63728, 1 ),
"update": 0,
"values": [ Vector3( 0, 0, 0 ), Vector3( -36.146, -1.281, 0 ) ]
"values": [ Vector3( 0, 0, 0 ), Vector3( -56.146, -1.281, 0 ), Vector3( 110.146, -1.281, 0 ), Vector3( 0, 0, 0 ) ]
}
[node name="Player" type="KinematicBody"]
@ -110,6 +110,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.84218, 0 )
[node name="Camera" type="Camera" parent="Head"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0154071, 0.355, -0.246618 )
doppler_tracking = 2
fov = 90.0
[node name="HitBox" type="Area" parent="Head/Camera"]
@ -147,23 +148,6 @@ cast_to = Vector3( 0, -1.5, 0 )
anims/RESET = SubResource( 5 )
anims/basic_slap = SubResource( 6 )
[node name="AudioSlap" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource( 5 )
attenuation_model = 2
unit_db = 80.0
max_db = 6.0
bus = "SFX"
[node name="AudioMegaSlap" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource( 6 )
attenuation_model = 2
unit_db = 60.0
max_db = 4.0
pitch_scale = 2.0
bus = "SFX"
emission_angle_enabled = true
doppler_tracking = 2
[node name="Music" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 13 )
volume_db = -3.0
@ -215,4 +199,9 @@ pitch_scale = 0.79
bus = "SFX"
doppler_tracking = 2
[node name="AudioWhoosh" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 5 )
volume_db = -9.613
pitch_scale = 8.0
[connection signal="timeout" from="SlapCooldown" to="." method="_on_SlapCooldown_timeout"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=2]
[gd_scene load_steps=18 format=2]
[ext_resource path="res://Scripts/HitBox.gd" type="Script" id=1]
[ext_resource path="res://Scenes/Enemy.gd" type="Script" id=2]
@ -6,6 +6,8 @@
[ext_resource path="res://Materials/Ball_Mat.tres" type="Material" id=4]
[ext_resource path="res://Materials/Black_Contour.tres" type="Material" id=5]
[ext_resource path="res://Audio/boom.wav" type="AudioStream" id=7]
[ext_resource path="res://Audio/80-s-clap.wav" type="AudioStream" id=8]
[ext_resource path="res://Audio/MegaSlap.wav" type="AudioStream" id=9]
[sub_resource type="SphereMesh" id=16]
@ -56,6 +58,25 @@ script = ExtResource( 3 )
[node name="HeadCollision" type="CollisionShape" parent="Hurtbox"]
shape = SubResource( 7 )
[node name="AudioSlap" type="AudioStreamPlayer3D" parent="Hurtbox"]
transform = Transform( 0.491077, 0, 0, 0, 0.491077, 0, 0, 0, 0.491077, 0, 0, 0 )
stream = ExtResource( 8 )
attenuation_model = 2
unit_db = 80.0
max_db = 6.0
bus = "SFX"
[node name="AudioMegaSlap" type="AudioStreamPlayer3D" parent="Hurtbox"]
transform = Transform( 0.491077, 0, 0, 0, 0.491077, 0, 0, 0, 0.491077, 0, 0, 0 )
stream = ExtResource( 9 )
attenuation_model = 2
unit_db = 60.0
max_db = 4.0
pitch_scale = 2.0
bus = "SFX"
emission_angle_enabled = true
doppler_tracking = 2
[node name="EnemyCollision" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.094023, 0 )
shape = SubResource( 8 )

View File

@ -1,6 +1,9 @@
class_name HurtBox
extends Area
onready var Slap = $AudioSlap
onready var MegaSlap = $AudioMegaSlap
func _init():
collision_layer = 0
collision_mask = 2
@ -14,7 +17,12 @@ func _on_area_entered(hitbox: HitBox):
if hitbox.hitbox_type == hitbox.HitboxType.Unassigned:
return
if hitbox.hitbox_type == hitbox.HitboxType.Slap and owner.has_method("get_slapped"):
owner.get_slapped(hitbox.slap_level,hitbox.slap_kill, hitbox.slap_vector)
if hitbox.slap_level >= hitbox.slap_kill:
MegaSlap.play()
else:
Slap.play()
elif hitbox.hitbox_type == hitbox.HitboxType.Projectile and owner.has_method("get_shot"):
owner.get_shot(hitbox.owner)

View File

@ -4,11 +4,11 @@ var ingame = false
onready var NewGame = $"New Game"
onready var QuitGame = $"Quit Game"
onready var QuitDesktop = $"Quit to Desktop"
onready var Music = $"MenuMusic"
onready var MMusic = $"MenuMusic"
func _ready():
Music.play()
self.show()
MMusic.play()
get_parent().show()
get_tree().paused = true
QuitGame.hide()
QuitDesktop.margin_top -= 44
@ -19,11 +19,11 @@ func _on_Quit_to_Desktop_Button_pressed():
get_tree().quit()
func _on_New_Game_pressed():
self.hide()
get_parent().hide()
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
get_tree().paused = false
ingame = true
Music.stop()
MMusic.stop()
func openMenu():
if (ingame):
@ -33,9 +33,10 @@ func openMenu():
QuitDesktop.margin_top = 664
QuitDesktop.margin_bottom = 708
self.show()
get_parent().show()
get_tree().paused = true
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
func _on_Quit_Game_pressed():
get_tree().reload_current_scene()
get_tree().paused = true

View File

@ -22,7 +22,7 @@ bus/1/name = "SFX"
bus/1/solo = false
bus/1/mute = false
bus/1/bypass_fx = false
bus/1/volume_db = 6.02
bus/1/volume_db = 0.0
bus/1/send = "Master"
bus/1/effect/0/effect = SubResource( 2 )
bus/1/effect/0/enabled = false
@ -32,5 +32,5 @@ bus/2/name = "Music"
bus/2/solo = false
bus/2/mute = false
bus/2/bypass_fx = false
bus/2/volume_db = -3.76831
bus/2/volume_db = 0.0
bus/2/send = "Master"

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 47 KiB