Merge branch 'main' of https://github.com/MarcEricMartel/FirstPersonSlapper
This commit is contained in:
commit
8975fbed27
117
HUD.tscn
117
HUD.tscn
@ -1,16 +1,9 @@
|
|||||||
[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://SlapGauge.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Title Timer.gd" type="Script" id=2]
|
[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://fonts/TorontoSubwayRegular.ttf" type="DynamicFontData" id=3]
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=7]
|
|
||||||
size = 88
|
|
||||||
outline_size = 5
|
|
||||||
outline_color = Color( 0, 0, 0, 1 )
|
|
||||||
use_filter = true
|
|
||||||
font_data = ExtResource( 3 )
|
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=4]
|
[sub_resource type="DynamicFont" id=4]
|
||||||
size = 19
|
size = 19
|
||||||
outline_size = 2
|
outline_size = 2
|
||||||
@ -22,17 +15,6 @@ font_data = ExtResource( 3 )
|
|||||||
[sub_resource type="Theme" id=8]
|
[sub_resource type="Theme" id=8]
|
||||||
default_font = SubResource( 4 )
|
default_font = SubResource( 4 )
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=9]
|
|
||||||
size = 19
|
|
||||||
outline_size = 2
|
|
||||||
outline_color = Color( 0, 0, 0, 1 )
|
|
||||||
use_mipmaps = true
|
|
||||||
use_filter = true
|
|
||||||
font_data = ExtResource( 3 )
|
|
||||||
|
|
||||||
[sub_resource type="Theme" id=10]
|
|
||||||
default_font = SubResource( 9 )
|
|
||||||
|
|
||||||
[sub_resource type="Shader" id=6]
|
[sub_resource type="Shader" id=6]
|
||||||
code = "shader_type canvas_item;
|
code = "shader_type canvas_item;
|
||||||
render_mode unshaded;
|
render_mode unshaded;
|
||||||
@ -69,40 +51,20 @@ shader_param/kill = null
|
|||||||
shader_param/bkgcol = Plane( 0, 0, 0, 0.3 )
|
shader_param/bkgcol = Plane( 0, 0, 0, 0.3 )
|
||||||
shader_param/kilcol = Plane( 0.5, 0, 0, 0.3 )
|
shader_param/kilcol = Plane( 0.5, 0, 0, 0.3 )
|
||||||
|
|
||||||
|
[sub_resource type="DynamicFont" id=12]
|
||||||
|
size = 33
|
||||||
|
use_filter = true
|
||||||
|
font_data = ExtResource( 3 )
|
||||||
|
|
||||||
|
[sub_resource type="DynamicFont" id=7]
|
||||||
|
size = 88
|
||||||
|
outline_size = 5
|
||||||
|
outline_color = Color( 0, 0, 0, 1 )
|
||||||
|
use_filter = true
|
||||||
|
font_data = ExtResource( 3 )
|
||||||
|
|
||||||
[node name="HUD" type="CanvasLayer"]
|
[node name="HUD" type="CanvasLayer"]
|
||||||
|
follow_viewport_enable = true
|
||||||
[node name="Start" type="Control" parent="."]
|
|
||||||
visible = false
|
|
||||||
margin_right = 40.0
|
|
||||||
margin_bottom = 40.0
|
|
||||||
|
|
||||||
[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
|
|
||||||
custom_fonts/font = SubResource( 7 )
|
|
||||||
text = "FIRST PERSON SLAPPER"
|
|
||||||
|
|
||||||
[node name="Title Timer" type="Timer" parent="Start"]
|
|
||||||
one_shot = true
|
|
||||||
script = ExtResource( 2 )
|
|
||||||
|
|
||||||
[node name="New Game" type="Button" parent="Start"]
|
|
||||||
anchor_left = 12.85
|
|
||||||
anchor_top = 10.525
|
|
||||||
anchor_right = 12.85
|
|
||||||
anchor_bottom = 10.525
|
|
||||||
margin_left = -67.0
|
|
||||||
margin_top = -20.0
|
|
||||||
margin_right = 70.0
|
|
||||||
margin_bottom = 16.0
|
|
||||||
theme = SubResource( 8 )
|
|
||||||
text = "New Game"
|
|
||||||
|
|
||||||
[node name="ActualHUD" type="Control" parent="."]
|
[node name="ActualHUD" type="Control" parent="."]
|
||||||
anchor_left = 0.037
|
anchor_left = 0.037
|
||||||
@ -111,7 +73,7 @@ anchor_right = 0.037
|
|||||||
anchor_bottom = 0.916
|
anchor_bottom = 0.916
|
||||||
margin_right = 40.0
|
margin_right = 40.0
|
||||||
margin_bottom = 40.0
|
margin_bottom = 40.0
|
||||||
theme = SubResource( 10 )
|
theme = SubResource( 8 )
|
||||||
|
|
||||||
[node name="SlapGauge" type="ColorRect" parent="ActualHUD"]
|
[node name="SlapGauge" type="ColorRect" parent="ActualHUD"]
|
||||||
material = SubResource( 11 )
|
material = SubResource( 11 )
|
||||||
@ -130,3 +92,50 @@ margin_top = -169.452
|
|||||||
margin_right = -3572.2
|
margin_right = -3572.2
|
||||||
margin_bottom = -137.452
|
margin_bottom = -137.452
|
||||||
text = "Slap"
|
text = "Slap"
|
||||||
|
|
||||||
|
[node name="Start" type="Control" parent="."]
|
||||||
|
pause_mode = 2
|
||||||
|
margin_right = 40.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
theme = SubResource( 8 )
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="Background" type="ColorRect" parent="Start"]
|
||||||
|
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"]
|
||||||
|
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 = 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 = 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 = 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"]
|
||||||
|
[connection signal="pressed" from="Start/Quit to Desktop" to="Start" method="_on_Quit_to_Desktop_Button_pressed"]
|
||||||
|
[connection signal="pressed" from="Start/Quit Game" to="Start" method="_on_Quit_Game_pressed"]
|
||||||
|
28
Player.gd
28
Player.gd
@ -7,6 +7,7 @@ export var air_acceleration = 1
|
|||||||
export var normal_acceleration = 6
|
export var normal_acceleration = 6
|
||||||
export var gravity = 100
|
export var gravity = 100
|
||||||
export var jump = 30
|
export var jump = 30
|
||||||
|
export var slapkill = 0.8
|
||||||
var slap = 0.0
|
var slap = 0.0
|
||||||
var chargeSlap = false
|
var chargeSlap = false
|
||||||
var isSlap = false;
|
var isSlap = false;
|
||||||
@ -29,6 +30,13 @@ onready var slap_animator = $HandMovement
|
|||||||
func _ready():
|
func _ready():
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||||
slap_animator.current_animation = "basic_slap"
|
slap_animator.current_animation = "basic_slap"
|
||||||
|
onready var SlapGauge = $HUD/ActualHUD/SlapGauge
|
||||||
|
onready var Menu = $HUD/Start
|
||||||
|
onready var AudioSlap = $AudioSlap
|
||||||
|
onready var AudioMegaSlap = $AudioMegaSlap
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
pass
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event is InputEventMouseMotion:
|
if event is InputEventMouseMotion:
|
||||||
@ -39,6 +47,9 @@ func _input(event):
|
|||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
|
|
||||||
|
if Input.is_action_just_pressed("escape"):
|
||||||
|
Menu.openMenu();
|
||||||
|
|
||||||
if global_transform.origin.y < bottom_boudaries:
|
if global_transform.origin.y < bottom_boudaries:
|
||||||
global_transform.origin.x = 0
|
global_transform.origin.x = 0
|
||||||
global_transform.origin.y = 10
|
global_transform.origin.y = 10
|
||||||
@ -58,7 +69,6 @@ func _physics_process(delta):
|
|||||||
gravity_vec = -get_floor_normal()
|
gravity_vec = -get_floor_normal()
|
||||||
h_acceleration = normal_acceleration
|
h_acceleration = normal_acceleration
|
||||||
|
|
||||||
|
|
||||||
if Input.is_action_just_pressed("jump") and (is_on_floor() or ground_check.is_colliding()):
|
if Input.is_action_just_pressed("jump") and (is_on_floor() or ground_check.is_colliding()):
|
||||||
gravity_vec = Vector3.UP * jump
|
gravity_vec = Vector3.UP * jump
|
||||||
|
|
||||||
@ -72,13 +82,22 @@ func _physics_process(delta):
|
|||||||
direction += transform.basis.x
|
direction += transform.basis.x
|
||||||
|
|
||||||
# Slappening
|
# Slappening
|
||||||
if Input.is_action_just_pressed("slap"):
|
if Input.is_action_pressed("slap"):
|
||||||
|
if slap < 0.01:
|
||||||
chargeSlap = true;
|
chargeSlap = true;
|
||||||
elif Input.is_action_just_released("slap"):
|
elif Input.is_action_just_released("slap"):
|
||||||
chargeSlap = false;
|
if chargeSlap:
|
||||||
isSlap = true;
|
isSlap = true;
|
||||||
|
chargeSlap = false;
|
||||||
else:
|
else:
|
||||||
isSlap = false;
|
isSlap = false;
|
||||||
|
|
||||||
|
if isSlap:
|
||||||
|
if slap >= slapkill:
|
||||||
|
AudioMegaSlap.play()
|
||||||
|
else:
|
||||||
|
AudioSlap.play()
|
||||||
|
|
||||||
if (chargeSlap):
|
if (chargeSlap):
|
||||||
slap += delta * 1.5;
|
slap += delta * 1.5;
|
||||||
else:
|
else:
|
||||||
@ -87,6 +106,9 @@ func _physics_process(delta):
|
|||||||
|
|
||||||
slap_gauge.fill = slap
|
slap_gauge.fill = slap
|
||||||
slap_animator.seek(slap, true)
|
slap_animator.seek(slap, true)
|
||||||
|
SlapGauge.fill = slap;
|
||||||
|
SlapGauge.kill = slapkill;
|
||||||
|
|
||||||
|
|
||||||
direction = direction.normalized()
|
direction = direction.normalized()
|
||||||
h_velocity = h_velocity.linear_interpolate(direction * speed, h_acceleration * delta)
|
h_velocity = h_velocity.linear_interpolate(direction * speed, h_acceleration * delta)
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
[ext_resource path="res://BlenderStuff/Hand/protohand.obj" type="ArrayMesh" id=2]
|
[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://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://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]
|
[sub_resource type="CapsuleShape" id=2]
|
||||||
height = 3.0
|
height = 3.0
|
||||||
@ -118,3 +120,8 @@ cast_to = Vector3( 0, -1.5, 0 )
|
|||||||
[node name="HandMovement" type="AnimationPlayer" parent="."]
|
[node name="HandMovement" type="AnimationPlayer" parent="."]
|
||||||
anims/RESET = SubResource( 5 )
|
anims/RESET = SubResource( 5 )
|
||||||
anims/basic_slap = SubResource( 6 )
|
anims/basic_slap = SubResource( 6 )
|
||||||
|
[node name="AudioSlap" type="AudioStreamPlayer3D" parent="."]
|
||||||
|
stream = ExtResource( 5 )
|
||||||
|
|
||||||
|
[node name="AudioMegaSlap" type="AudioStreamPlayer3D" parent="."]
|
||||||
|
stream = ExtResource( 6 )
|
||||||
|
37
Start.gd
Normal file
37
Start.gd
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
var ingame = false
|
||||||
|
onready var NewGame = $"New Game"
|
||||||
|
onready var QuitGame = $"Quit Game"
|
||||||
|
onready var QuitDesktop = $"Quit to Desktop"
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
get_tree().paused = true
|
||||||
|
QuitGame.hide()
|
||||||
|
QuitDesktop.margin_top -= 44
|
||||||
|
QuitDesktop.margin_bottom -= 44
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||||
|
|
||||||
|
func _on_Quit_to_Desktop_Button_pressed():
|
||||||
|
get_tree().quit()
|
||||||
|
|
||||||
|
func _on_New_Game_pressed():
|
||||||
|
self.hide()
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||||
|
get_tree().paused = false
|
||||||
|
ingame = true
|
||||||
|
|
||||||
|
func openMenu():
|
||||||
|
if (ingame):
|
||||||
|
NewGame.set_text("Continue Game")
|
||||||
|
QuitGame.show();
|
||||||
|
|
||||||
|
QuitDesktop.margin_top = 664
|
||||||
|
QuitDesktop.margin_bottom = 708
|
||||||
|
|
||||||
|
self.show()
|
||||||
|
get_tree().paused = true
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||||
|
|
||||||
|
func _on_Quit_Game_pressed():
|
||||||
|
get_tree().reload_current_scene()
|
@ -69,6 +69,11 @@ slap={
|
|||||||
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)
|
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
escape={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user