forked from funnymemellama/funnymemellama
Merge branch 'master' of ssh://play.qtechofficial.com:9940/funnymemellama/funnymemellama
This commit is contained in:
commit
ed5247cc77
4 changed files with 79 additions and 51 deletions
|
@ -60,14 +60,14 @@ func interact(other):
|
||||||
|
|
||||||
func _on_anim_finished(name):
|
func _on_anim_finished(name):
|
||||||
if _resetting:
|
if _resetting:
|
||||||
|
_sound.stop()
|
||||||
|
_sound.stream = release_sound
|
||||||
|
_sound.play()
|
||||||
_button.material = released_material
|
_button.material = released_material
|
||||||
_resetting = false
|
_resetting = false
|
||||||
_triggered = false
|
_triggered = false
|
||||||
|
|
||||||
if momentary and _triggered:
|
if momentary and _triggered:
|
||||||
_sound.stop()
|
|
||||||
_sound.stream = release_sound
|
|
||||||
_sound.play()
|
|
||||||
_anim.play_backwards('trigger')
|
_anim.play_backwards('trigger')
|
||||||
_resetting = true
|
_resetting = true
|
||||||
|
|
||||||
|
|
2
Debug.gd
2
Debug.gd
|
@ -11,7 +11,7 @@ func _process(delta):
|
||||||
var v = $Player.velocity
|
var v = $Player.velocity
|
||||||
var hvel = sqrt(v.x ** 2 + v.z ** 2)
|
var hvel = sqrt(v.x ** 2 + v.z ** 2)
|
||||||
var vvel = v.y
|
var vvel = v.y
|
||||||
$Speed.text = 'Speed: %6.2f, %6.2f' % [hvel, vvel]
|
$Speed.text = 'Speed: %6.2f, %6.2f' % [hvel * 16, vvel * 16]
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent):
|
func _input(event: InputEvent):
|
||||||
|
|
34
Player.gd
34
Player.gd
|
@ -4,15 +4,18 @@ extends CharacterBody3D
|
||||||
const QUAKE = 0.0625
|
const QUAKE = 0.0625
|
||||||
const g = -800 * QUAKE
|
const g = -800 * QUAKE
|
||||||
const MAX_SPEED = 320 * QUAKE
|
const MAX_SPEED = 320 * QUAKE
|
||||||
|
const MAX_AIR_SPEED = 30 * QUAKE
|
||||||
const FRICTION = 4# * QUAKE
|
const FRICTION = 4# * QUAKE
|
||||||
const STOP_SPEED = 100 * QUAKE
|
const STOP_SPEED = 100 * QUAKE
|
||||||
const ACCEL= 10# * QUAKE
|
const ACCEL = 15# * QUAKE
|
||||||
const FORWARD_SPEED = 400 * QUAKE
|
const AIR_ACCEL = 2# * QUAKE
|
||||||
|
const FORWARD_SPEED = 200 * QUAKE
|
||||||
const SIDE_SPEED = 350 * QUAKE
|
const SIDE_SPEED = 350 * QUAKE
|
||||||
const UP_SPEED = 270 * QUAKE
|
const UP_SPEED = 270 * QUAKE
|
||||||
|
const JUMP_SPEED = 270 * QUAKE
|
||||||
|
|
||||||
# const DEACCEL= 8
|
# const DEACCEL= 8
|
||||||
# const MAX_SLOPE_ANGLE = 30
|
# const MAX_SLOPE_ANGLE = 30https://www.youtube.com/watch?v=v3zT3Z5apaM
|
||||||
|
|
||||||
@onready
|
@onready
|
||||||
var camera = $CSGMesh3D/Camera3D
|
var camera = $CSGMesh3D/Camera3D
|
||||||
|
@ -40,8 +43,8 @@ func _physics_process(delta):
|
||||||
smove += -SIDE_SPEED
|
smove += -SIDE_SPEED
|
||||||
if Input.is_action_pressed("move_right"):
|
if Input.is_action_pressed("move_right"):
|
||||||
smove += SIDE_SPEED
|
smove += SIDE_SPEED
|
||||||
if Input.is_action_pressed("jump"):
|
#if Input.is_action_pressed("up"):
|
||||||
upmove += UP_SPEED
|
# upmove += UP_SPEED
|
||||||
if Input.is_action_pressed("run"):
|
if Input.is_action_pressed("run"):
|
||||||
fmove *= 2.0
|
fmove *= 2.0
|
||||||
smove *= 2.0
|
smove *= 2.0
|
||||||
|
@ -54,8 +57,6 @@ func _physics_process(delta):
|
||||||
|
|
||||||
if _noclip:
|
if _noclip:
|
||||||
wishvel.y += upmove
|
wishvel.y += upmove
|
||||||
# else:
|
|
||||||
# wishvel.y = upmove
|
|
||||||
|
|
||||||
var wishdir = wishvel.normalized()
|
var wishdir = wishvel.normalized()
|
||||||
var wishspeed = wishvel.length()
|
var wishspeed = wishvel.length()
|
||||||
|
@ -64,8 +65,9 @@ func _physics_process(delta):
|
||||||
wishvel *= MAX_SPEED / wishspeed
|
wishvel *= MAX_SPEED / wishspeed
|
||||||
wishspeed = MAX_SPEED
|
wishspeed = MAX_SPEED
|
||||||
|
|
||||||
if is_on_floor():
|
if Input.is_action_pressed("jump") and is_on_floor():
|
||||||
velocity.y += upmove
|
velocity.y += JUMP_SPEED
|
||||||
|
|
||||||
var vel = velocity
|
var vel = velocity
|
||||||
if _noclip:
|
if _noclip:
|
||||||
vel = wishvel
|
vel = wishvel
|
||||||
|
@ -73,7 +75,7 @@ func _physics_process(delta):
|
||||||
vel = _apply_friction(vel, delta)
|
vel = _apply_friction(vel, delta)
|
||||||
vel = _apply_accel(vel, wishdir, wishspeed, delta)
|
vel = _apply_accel(vel, wishdir, wishspeed, delta)
|
||||||
else:
|
else:
|
||||||
vel = _apply_air_accel(vel, wishvel, wishspeed, delta)
|
vel = _apply_air_accel(vel, wishvel, delta)
|
||||||
|
|
||||||
if not _noclip:
|
if not _noclip:
|
||||||
vel.y += g * delta
|
vel.y += g * delta
|
||||||
|
@ -100,8 +102,8 @@ func _apply_friction(vel: Vector3, delta: float):
|
||||||
|
|
||||||
if newspeed < 0.0:
|
if newspeed < 0.0:
|
||||||
newspeed = 0.0
|
newspeed = 0.0
|
||||||
|
else:
|
||||||
newspeed /= speed
|
newspeed /= speed
|
||||||
|
|
||||||
return vel * newspeed
|
return vel * newspeed
|
||||||
|
|
||||||
|
@ -117,19 +119,19 @@ func _apply_accel(vel: Vector3, wishdir: Vector3, wishspeed: float, delta: float
|
||||||
|
|
||||||
return vel + accelspeed * wishdir
|
return vel + accelspeed * wishdir
|
||||||
|
|
||||||
func _apply_air_accel(vel: Vector3, wishvel: Vector3, wishspeed: float, delta: float):
|
func _apply_air_accel(vel: Vector3, wishvel: Vector3, delta: float):
|
||||||
var wishveloc = wishvel.normalized()
|
var wishveloc = wishvel.normalized()
|
||||||
var wishspd = wishvel.length()
|
var wishspd = wishvel.length()
|
||||||
|
|
||||||
if wishspd > 30 * QUAKE:
|
if wishspd > MAX_AIR_SPEED:
|
||||||
wishspd = 30 * QUAKE
|
wishspd = MAX_AIR_SPEED
|
||||||
|
|
||||||
var currentspeed = vel.dot(wishveloc)
|
var currentspeed = vel.dot(wishveloc)
|
||||||
var addspeed = wishspd - currentspeed
|
var addspeed = wishspd - currentspeed
|
||||||
if addspeed <= 0:
|
if addspeed <= 0:
|
||||||
return vel
|
return vel
|
||||||
|
|
||||||
var accelspeed = ACCEL * wishspeed * delta
|
var accelspeed = AIR_ACCEL * wishspd * delta
|
||||||
if accelspeed > addspeed:
|
if accelspeed > addspeed:
|
||||||
accelspeed = addspeed
|
accelspeed = addspeed
|
||||||
|
|
||||||
|
|
30
world.tscn
30
world.tscn
|
@ -1,10 +1,11 @@
|
||||||
[gd_scene load_steps=11 format=3 uid="uid://cv8621s5oukrb"]
|
[gd_scene load_steps=13 format=3 uid="uid://cv8621s5oukrb"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dyyf1q12dchhq" path="res://Player.tscn" id="2_jba6q"]
|
[ext_resource type="PackedScene" uid="uid://dyyf1q12dchhq" path="res://Player.tscn" id="2_jba6q"]
|
||||||
[ext_resource type="ArrayMesh" uid="uid://bqnoaomgwec3w" path="res://assets/maps/mapentities.obj" id="5_wn745"]
|
[ext_resource type="ArrayMesh" uid="uid://bqnoaomgwec3w" path="res://assets/maps/mapentities.obj" id="5_wn745"]
|
||||||
[ext_resource type="Script" path="res://KeyOverlay.gd" id="6_crgb3"]
|
[ext_resource type="Script" path="res://KeyOverlay.gd" id="6_crgb3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bp1fooevcl4lk" path="res://devworld.tscn" id="7_1im6f"]
|
[ext_resource type="PackedScene" uid="uid://bp1fooevcl4lk" path="res://devworld.tscn" id="7_1im6f"]
|
||||||
[ext_resource type="Script" path="res://Debug.gd" id="7_2k2sn"]
|
[ext_resource type="Script" path="res://Debug.gd" id="7_2k2sn"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dast4ubkinjb5" path="res://assets/textures/zombietextures_funny/kreb.png" id="7_f82yj"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dnk6bedcy6x6m" path="res://hazardcourse.tscn" id="8_t5ilw"]
|
[ext_resource type="PackedScene" uid="uid://dnk6bedcy6x6m" path="res://hazardcourse.tscn" id="8_t5ilw"]
|
||||||
|
|
||||||
[sub_resource type="SystemFont" id="SystemFont_4krkk"]
|
[sub_resource type="SystemFont" id="SystemFont_4krkk"]
|
||||||
|
@ -22,6 +23,10 @@ font_names = PackedStringArray("Monospace")
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_f35h2"]
|
[sub_resource type="LabelSettings" id="LabelSettings_f35h2"]
|
||||||
font = SubResource("SystemFont_4l16k")
|
font = SubResource("SystemFont_4l16k")
|
||||||
|
|
||||||
|
[sub_resource type="Environment" id="Environment_4rf1u"]
|
||||||
|
ambient_light_source = 1
|
||||||
|
reflected_light_source = 1
|
||||||
|
|
||||||
[node name="Root" type="Node"]
|
[node name="Root" type="Node"]
|
||||||
script = ExtResource("7_2k2sn")
|
script = ExtResource("7_2k2sn")
|
||||||
|
|
||||||
|
@ -33,7 +38,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 18.9032, 0)
|
||||||
light_color = Color(1, 0.862745, 0.721569, 1)
|
light_color = Color(1, 0.862745, 0.721569, 1)
|
||||||
light_energy = 16.0
|
light_energy = 16.0
|
||||||
light_size = 400.0
|
light_size = 400.0
|
||||||
omni_range = 99.7884
|
shadow_enabled = true
|
||||||
|
omni_range = 181.439
|
||||||
|
|
||||||
[node name="Mapentities" type="MeshInstance3D" parent="."]
|
[node name="Mapentities" type="MeshInstance3D" parent="."]
|
||||||
transform = Transform3D(0.039, 0, 0, 0, -1.70474e-09, 0.039, 0, -0.039, -1.70474e-09, 0, 0, 0)
|
transform = Transform3D(0.039, 0, 0, 0, -1.70474e-09, 0.039, 0, -0.039, -1.70474e-09, 0, 0, 0)
|
||||||
|
@ -61,3 +67,23 @@ offset_right = 113.0
|
||||||
offset_bottom = 136.0
|
offset_bottom = 136.0
|
||||||
text = "SPEED"
|
text = "SPEED"
|
||||||
label_settings = SubResource("LabelSettings_f35h2")
|
label_settings = SubResource("LabelSettings_f35h2")
|
||||||
|
|
||||||
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||||
|
environment = SubResource("Environment_4rf1u")
|
||||||
|
|
||||||
|
[node name="SpotLight3D" type="SpotLight3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -5.12, 12.1948, -30.2711)
|
||||||
|
light_energy = 500.0
|
||||||
|
light_projector = ExtResource("7_f82yj")
|
||||||
|
shadow_enabled = true
|
||||||
|
spot_range = 52.48
|
||||||
|
spot_angle = 26.8834
|
||||||
|
|
||||||
|
[node name="SpotLight3D" type="SpotLight3D" parent="SpotLight3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.04, 0.0400009, 0)
|
||||||
|
light_energy = 500.0
|
||||||
|
light_projector = ExtResource("7_f82yj")
|
||||||
|
light_negative = true
|
||||||
|
shadow_enabled = true
|
||||||
|
spot_range = 52.48
|
||||||
|
spot_angle = 26.8834
|
||||||
|
|
Loading…
Reference in a new issue