AUDIOSLAP

This commit is contained in:
MarcEricMartel 2022-10-11 14:57:56 -04:00
parent 06ad712fd9
commit 286abb5032
5 changed files with 65 additions and 50 deletions

View File

@ -1,10 +1,10 @@
[gd_scene load_steps=11 format=2]
[gd_scene load_steps=10 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]
[sub_resource type="DynamicFont" id=9]
[sub_resource type="DynamicFont" id=4]
size = 19
outline_size = 2
outline_color = Color( 0, 0, 0, 1 )
@ -12,8 +12,8 @@ use_mipmaps = true
use_filter = true
font_data = ExtResource( 3 )
[sub_resource type="Theme" id=10]
default_font = SubResource( 9 )
[sub_resource type="Theme" id=8]
default_font = SubResource( 4 )
[sub_resource type="Shader" id=6]
code = "shader_type canvas_item;
@ -51,17 +51,11 @@ shader_param/kill = null
shader_param/bkgcol = Plane( 0, 0, 0, 0.3 )
shader_param/kilcol = Plane( 0.5, 0, 0, 0.3 )
[sub_resource type="DynamicFont" id=4]
size = 19
outline_size = 2
outline_color = Color( 0, 0, 0, 1 )
use_mipmaps = true
[sub_resource type="DynamicFont" id=12]
size = 33
use_filter = true
font_data = ExtResource( 3 )
[sub_resource type="Theme" id=8]
default_font = SubResource( 4 )
[sub_resource type="DynamicFont" id=7]
size = 88
outline_size = 5
@ -70,11 +64,12 @@ use_filter = true
font_data = ExtResource( 3 )
[node name="HUD" type="CanvasLayer"]
follow_viewport_enable = true
[node name="ActualHUD" type="Control" parent="."]
margin_right = 40.0
margin_bottom = 40.0
theme = SubResource( 10 )
theme = SubResource( 8 )
[node name="SlapGauge" type="ColorRect" parent="ActualHUD"]
material = SubResource( 11 )
@ -82,10 +77,10 @@ anchor_left = 12.875
anchor_top = 7.625
anchor_right = 12.875
anchor_bottom = 7.625
margin_left = -451.0
margin_top = 218.0
margin_right = -161.0
margin_bottom = 241.0
margin_left = -464.0
margin_top = 666.0
margin_right = 114.0
margin_bottom = 699.0
script = ExtResource( 1 )
[node name="SlapLabel" type="Label" parent="ActualHUD"]
@ -94,10 +89,11 @@ anchor_left = 12.662
anchor_top = 7.324
anchor_right = 12.662
anchor_bottom = 7.324
margin_left = -436.48
margin_top = 229.04
margin_right = -325.48
margin_bottom = 261.04
margin_left = -441.48
margin_top = 673.04
margin_right = -380.48
margin_bottom = 712.04
custom_fonts/font = SubResource( 12 )
text = "Slap"
[node name="Start" type="Control" parent="."]
@ -108,43 +104,39 @@ theme = SubResource( 8 )
script = ExtResource( 2 )
[node name="Background" type="ColorRect" parent="Start"]
margin_left = -38.0
margin_top = -31.0
margin_right = 1079.0
margin_bottom = 624.0
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="Title" type="Label" parent="Start"]
anchor_left = 12.9
anchor_top = 7.625
anchor_right = 12.9
anchor_bottom = 7.625
margin_left = -439.0
margin_top = -54.0
margin_right = 443.0
margin_bottom = 48.0
margin_left = 532.0
margin_top = 353.0
margin_right = 1414.0
margin_bottom = 455.0
custom_fonts/font = SubResource( 7 )
text = "FIRST PERSON SLAPPER"
[node name="New Game" type="Button" parent="Start"]
margin_left = 431.0
margin_top = 393.0
margin_right = 606.0
margin_bottom = 437.0
margin_left = 886.0
margin_top = 554.0
margin_right = 1061.0
margin_bottom = 598.0
text = "New Game"
[node name="Quit to Desktop" type="Button" parent="Start"]
margin_left = 431.0
margin_top = 491.0
margin_right = 606.0
margin_bottom = 535.0
margin_left = 887.0
margin_top = 664.0
margin_right = 1062.0
margin_bottom = 708.0
text = "Quit to Desktop"
[node name="Quit Game" type="Button" parent="Start"]
margin_left = 431.0
margin_top = 442.0
margin_right = 606.0
margin_bottom = 486.0
margin_left = 887.0
margin_top = 609.0
margin_right = 1062.0
margin_bottom = 653.0
text = "Quit Game"
[connection signal="pressed" from="Start/New Game" to="Start" method="_on_New_Game_pressed"]

View File

@ -7,6 +7,7 @@ export var air_acceleration = 1
export var normal_acceleration = 6
export var gravity = 100
export var jump = 30
export var slapkill = 0.8
var slap = 0.0
var chargeSlap = false
var isSlap = false;
@ -25,6 +26,8 @@ onready var head = $Head
onready var ground_check = $GroundCheck
onready var SlapGauge = $HUD/ActualHUD/SlapGauge
onready var Menu = $HUD/Start
onready var AudioSlap = $AudioSlap
onready var AudioMegaSlap = $AudioMegaSlap
func _ready():
pass
@ -77,16 +80,25 @@ func _physics_process(delta):
if slap < 0.01:
chargeSlap = true;
elif Input.is_action_just_released("slap"):
chargeSlap = false;
if chargeSlap:
isSlap = true;
chargeSlap = false;
else:
isSlap = false;
if isSlap:
if slap >= slapkill:
AudioMegaSlap.play()
else:
AudioSlap.play()
if (chargeSlap):
slap += delta * 1.5;
else:
slap -= delta * 8.0;
slap = clamp(slap, 0.0, 1.0)
SlapGauge.fill = slap;
SlapGauge.kill = slapkill;
direction = direction.normalized()

View File

@ -1,9 +1,11 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=10 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]
[sub_resource type="CapsuleShape" id=2]
height = 3.0
@ -44,3 +46,9 @@ enabled = true
cast_to = Vector3( 0, -1.5, 0 )
[node name="HUD" parent="." instance=ExtResource( 4 )]
[node name="AudioSlap" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource( 5 )
[node name="AudioMegaSlap" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource( 6 )

View File

@ -26,8 +26,8 @@ func openMenu():
NewGame.set_text("Continue Game")
QuitGame.show();
QuitDesktop.margin_top = 491
QuitDesktop.margin_bottom = 535
QuitDesktop.margin_top = 664
QuitDesktop.margin_bottom = 708
self.show()
get_tree().paused = true

View File

@ -16,6 +16,9 @@ config/icon="res://icon.png"
[display]
window/size/width=1920
window/size/height=1080
window/size/fullscreen=true
window/stretch/aspect="keep"
[gui]