clean up code
This commit is contained in:
parent
d1017c6b07
commit
22e7cc855e
|
@ -1,6 +1,5 @@
|
||||||
extends Area
|
extends Area
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
# Declare member variables here. Examples:
|
||||||
# var a = 2
|
# var a = 2
|
||||||
# var b = "text"
|
# var b = "text"
|
||||||
|
@ -11,7 +10,6 @@ var player
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
player = get_node(@"../../../Player")
|
player = get_node(@"../../../Player")
|
||||||
#pass # Replace with function body.
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
rotate_y(delta)
|
rotate_y(delta)
|
||||||
|
@ -20,8 +18,6 @@ func _physics_process(delta):
|
||||||
player.addAntiDepressant()
|
player.addAntiDepressant()
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
#func _process(delta):
|
#func _process(delta):
|
||||||
# pass
|
# pass
|
||||||
|
|
11
Camera.gd
11
Camera.gd
|
@ -7,7 +7,6 @@ var downForceStrength = 0
|
||||||
#Mania
|
#Mania
|
||||||
export var max_offset = 0.3 # Maximum hor/ver shake in pixels.
|
export var max_offset = 0.3 # Maximum hor/ver shake in pixels.
|
||||||
export var max_roll = 0.1 # Maximum rotation in radians (use sparingly).
|
export var max_roll = 0.1 # Maximum rotation in radians (use sparingly).
|
||||||
#export (NodePath) var target # Assign the node this camera will follow.
|
|
||||||
|
|
||||||
var trauma = 0.0 # Current shake strength.
|
var trauma = 0.0 # Current shake strength.
|
||||||
var trauma_power = 2 # Trauma exponent. Use [2, 3].
|
var trauma_power = 2 # Trauma exponent. Use [2, 3].
|
||||||
|
@ -35,15 +34,12 @@ func changeDownForce(force):
|
||||||
downForceStrength = force
|
downForceStrength = force
|
||||||
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(_delta):
|
||||||
# if target:
|
|
||||||
# global_position = get_node(target).global_position
|
|
||||||
if trauma:
|
if trauma:
|
||||||
shake()
|
shake()
|
||||||
|
|
||||||
if downForceStrength<0:
|
if downForceStrength<0:
|
||||||
if(pivot.rotation.x > -1.4):
|
if(pivot.rotation.x > -1.4):
|
||||||
#print(pivot.rotation.x)
|
|
||||||
pivot.rotate_x(downForceStrength)
|
pivot.rotate_x(downForceStrength)
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,13 +48,8 @@ func shake():
|
||||||
var amount = pow(trauma, trauma_power)
|
var amount = pow(trauma, trauma_power)
|
||||||
noise_y += 1
|
noise_y += 1
|
||||||
# Using noise
|
# Using noise
|
||||||
#rotation = max_roll * amount * noise.get_noise_2d(noise.seed, noise_y)
|
|
||||||
v_offset = max_offset * amount * noise.get_noise_2d(noise.seed*3, noise_y)
|
v_offset = max_offset * amount * noise.get_noise_2d(noise.seed*3, noise_y)
|
||||||
h_offset = max_offset * amount * noise.get_noise_2d(noise.seed*2, noise_y)
|
h_offset = max_offset * amount * noise.get_noise_2d(noise.seed*2, noise_y)
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
#func _process(delta):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
|
|
||||||
func reset():
|
func reset():
|
||||||
trauma = 0
|
trauma = 0
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
extends OmniLight
|
extends OmniLight
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
# Declare member variables here.
|
||||||
# var a = 2
|
|
||||||
# var b = "text"
|
|
||||||
|
|
||||||
var _noise = OpenSimplexNoise.new()
|
var _noise = OpenSimplexNoise.new()
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +17,7 @@ func _ready():
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta):
|
func _process(_delta):
|
||||||
if(OS.get_ticks_msec()%100<10):
|
if(OS.get_ticks_msec()%100<10):
|
||||||
light_energy = 1 + _noise.get_noise_1d(OS.get_ticks_msec())
|
light_energy = 1 + _noise.get_noise_1d(OS.get_ticks_msec())
|
||||||
|
|
||||||
|
|
30
Main.gd
30
Main.gd
|
@ -1,9 +1,7 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
# Declare member variables here.
|
||||||
# var a = 2
|
|
||||||
# var b = "text"
|
|
||||||
|
|
||||||
var wantToQuit = false
|
var wantToQuit = false
|
||||||
|
|
||||||
|
@ -24,9 +22,6 @@ var stableTimer
|
||||||
var maniaTimer
|
var maniaTimer
|
||||||
var depressionTimer
|
var depressionTimer
|
||||||
|
|
||||||
#var moodStabilizerTimer
|
|
||||||
#var antiDepressantTimer
|
|
||||||
|
|
||||||
var secondsPerWeek = 10
|
var secondsPerWeek = 10
|
||||||
|
|
||||||
var rng = RandomNumberGenerator.new()
|
var rng = RandomNumberGenerator.new()
|
||||||
|
@ -62,22 +57,10 @@ func _ready():
|
||||||
stableTimer = $Timer/StableTimer
|
stableTimer = $Timer/StableTimer
|
||||||
maniaTimer = $Timer/ManiaTimer
|
maniaTimer = $Timer/ManiaTimer
|
||||||
depressionTimer = $Timer/DepressionTimer
|
depressionTimer = $Timer/DepressionTimer
|
||||||
|
|
||||||
# moodStabilizerTimer = $Collectibles/MoodStabilizer/Timer
|
|
||||||
# antiDepressantTimer = $Collectibles/AntiDepressant/Timer
|
|
||||||
|
|
||||||
|
|
||||||
#add_child(stableTimer)
|
|
||||||
#add_child(maniaTimer)
|
|
||||||
#add_child(depressionTimer)
|
|
||||||
# add_child(moodStabilizerTimer)
|
|
||||||
# add_child(antiDepressantTimer)
|
|
||||||
|
|
||||||
stableTimer.connect("timeout", self, "_on_StableTimer_timeout")
|
stableTimer.connect("timeout", self, "_on_StableTimer_timeout")
|
||||||
maniaTimer.connect("timeout", self, "_on_ManiaTimer_timeout")
|
maniaTimer.connect("timeout", self, "_on_ManiaTimer_timeout")
|
||||||
depressionTimer.connect("timeout", self, "_on_DepressionTimer_timeout")
|
depressionTimer.connect("timeout", self, "_on_DepressionTimer_timeout")
|
||||||
# moodStabilizerTimer.connect("timeout", self, "_on_MoodStabilizerTimer_timeout")
|
|
||||||
# antiDepressantTimer.connect("timeout", self, "_on_AntiDepressantTimer_timeout")
|
|
||||||
|
|
||||||
stableTimer.set_wait_time(secondsPerWeek*averageStable+rng.randf_range(-secondsPerWeek/5,+secondsPerWeek/5))
|
stableTimer.set_wait_time(secondsPerWeek*averageStable+rng.randf_range(-secondsPerWeek/5,+secondsPerWeek/5))
|
||||||
stableTimer.start()
|
stableTimer.start()
|
||||||
|
@ -86,7 +69,7 @@ func _ready():
|
||||||
theEnd = $HUD/AcceptDialog
|
theEnd = $HUD/AcceptDialog
|
||||||
|
|
||||||
|
|
||||||
func _input(event):
|
func _input(_event):
|
||||||
if Input.is_action_pressed("click"):
|
if Input.is_action_pressed("click"):
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||||
wantToQuit = false
|
wantToQuit = false
|
||||||
|
@ -220,7 +203,7 @@ func _process(delta):
|
||||||
|
|
||||||
changeEffectsByMood()
|
changeEffectsByMood()
|
||||||
|
|
||||||
sun.rotate_x(delta/2)
|
sun.rotate_x(delta/3)
|
||||||
|
|
||||||
|
|
||||||
hudMood.text = String(mood)
|
hudMood.text = String(mood)
|
||||||
|
@ -231,7 +214,6 @@ func _process(delta):
|
||||||
|
|
||||||
func _on_StableTimer_timeout():
|
func _on_StableTimer_timeout():
|
||||||
print("StableTimer_timeout")
|
print("StableTimer_timeout")
|
||||||
#mood = -1
|
|
||||||
p0 = 0
|
p0 = 0
|
||||||
p1 = -1
|
p1 = -1
|
||||||
t = 0
|
t = 0
|
||||||
|
@ -242,7 +224,6 @@ func _on_StableTimer_timeout():
|
||||||
|
|
||||||
func _on_ManiaTimer_timeout():
|
func _on_ManiaTimer_timeout():
|
||||||
print("ManiaTimer_timeout")
|
print("ManiaTimer_timeout")
|
||||||
#mood = 0
|
|
||||||
p0 = 1
|
p0 = 1
|
||||||
p1 = 0
|
p1 = 0
|
||||||
t = 0
|
t = 0
|
||||||
|
@ -252,7 +233,6 @@ func _on_ManiaTimer_timeout():
|
||||||
|
|
||||||
func _on_DepressionTimer_timeout():
|
func _on_DepressionTimer_timeout():
|
||||||
print("DepressionTimer_timeout")
|
print("DepressionTimer_timeout")
|
||||||
#mood = +1
|
|
||||||
p0 = -1
|
p0 = -1
|
||||||
p1 = +1
|
p1 = +1
|
||||||
t = 0
|
t = 0
|
||||||
|
@ -272,14 +252,12 @@ func takingpill():
|
||||||
takingPill = false
|
takingPill = false
|
||||||
|
|
||||||
func smoothMood(deltaTime: float):
|
func smoothMood(deltaTime: float):
|
||||||
#print(p0," ",p1)
|
|
||||||
t += deltaTime
|
t += deltaTime
|
||||||
if(t>1):
|
if(t>1):
|
||||||
t=1
|
t=1
|
||||||
if(t<-1):
|
if(t<-1):
|
||||||
t=-1
|
t=-1
|
||||||
mood = p0 * (1 - t) + p1 * t
|
mood = p0 * (1 - t) + p1 * t
|
||||||
#print(mood)
|
|
||||||
|
|
||||||
func showEnd():
|
func showEnd():
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED)
|
Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=38 format=2]
|
[gd_scene load_steps=39 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Player.gd" type="Script" id=1]
|
[ext_resource path="res://Player.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Camera.gd" type="Script" id=2]
|
[ext_resource path="res://Camera.gd" type="Script" id=2]
|
||||||
|
@ -32,10 +32,13 @@ albedo_color = Color( 1, 0.890196, 0, 1 )
|
||||||
[sub_resource type="CapsuleMesh" id=9]
|
[sub_resource type="CapsuleMesh" id=9]
|
||||||
|
|
||||||
[sub_resource type="SpatialMaterial" id=10]
|
[sub_resource type="SpatialMaterial" id=10]
|
||||||
albedo_color = Color( 0.0784314, 1, 0, 1 )
|
albedo_color = Color( 0.905882, 0.0509804, 0.956863, 1 )
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape" id=8]
|
[sub_resource type="CapsuleShape" id=8]
|
||||||
|
|
||||||
|
[sub_resource type="SpatialMaterial" id=30]
|
||||||
|
albedo_color = Color( 0, 1, 0, 1 )
|
||||||
|
|
||||||
[sub_resource type="CubeMesh" id=4]
|
[sub_resource type="CubeMesh" id=4]
|
||||||
|
|
||||||
[sub_resource type="BoxShape" id=5]
|
[sub_resource type="BoxShape" id=5]
|
||||||
|
@ -199,7 +202,7 @@ script = ExtResource( 9 )
|
||||||
[node name="MeshInstance" type="MeshInstance" parent="Collectibles/UnlimitedMeds"]
|
[node name="MeshInstance" type="MeshInstance" parent="Collectibles/UnlimitedMeds"]
|
||||||
mesh = SubResource( 9 )
|
mesh = SubResource( 9 )
|
||||||
skeleton = NodePath("")
|
skeleton = NodePath("")
|
||||||
material/0 = SubResource( 10 )
|
material/0 = SubResource( 30 )
|
||||||
|
|
||||||
[node name="CollisionShape" type="CollisionShape" parent="Collectibles/UnlimitedMeds"]
|
[node name="CollisionShape" type="CollisionShape" parent="Collectibles/UnlimitedMeds"]
|
||||||
shape = SubResource( 8 )
|
shape = SubResource( 8 )
|
||||||
|
|
|
@ -10,7 +10,6 @@ var player
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
player = get_node(@"../../../Player")
|
player = get_node(@"../../../Player")
|
||||||
#pass # Replace with function body.
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
rotate_y(delta)
|
rotate_y(delta)
|
||||||
|
|
23
Player.gd
23
Player.gd
|
@ -1,9 +1,7 @@
|
||||||
extends KinematicBody
|
extends KinematicBody
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
# Declare member variables here.
|
||||||
# var a = 2
|
|
||||||
# var b = "text"
|
|
||||||
|
|
||||||
var MAX_SPEED = 7
|
var MAX_SPEED = 7
|
||||||
var ACCEL = 3.5
|
var ACCEL = 3.5
|
||||||
|
@ -91,12 +89,6 @@ func _physics_process(delta):
|
||||||
vel = move_and_slide(vel, Vector3(0, 1, 0), 0.05, 4, deg2rad(MAX_SLOPE_ANGLE))
|
vel = move_and_slide(vel, Vector3(0, 1, 0), 0.05, 4, deg2rad(MAX_SLOPE_ANGLE))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
|
||||||
# var a = 2
|
|
||||||
# var b = "text"
|
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
||||||
rotation_helper.rotate_x(deg2rad(event.relative.y * MOUSE_SENSITIVITY * -1))
|
rotation_helper.rotate_x(deg2rad(event.relative.y * MOUSE_SENSITIVITY * -1))
|
||||||
|
@ -138,19 +130,6 @@ func _ready():
|
||||||
rotation_helper = $CameraPivot
|
rotation_helper = $CameraPivot
|
||||||
hud = get_node(@"../HUD")
|
hud = get_node(@"../HUD")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#pass # Replace with function body.
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
#func _ready():
|
|
||||||
# pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
#func _process(delta):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
|
|
||||||
func addMoodStabilizer():
|
func addMoodStabilizer():
|
||||||
moodStabilizer = moodStabilizer + 1
|
moodStabilizer = moodStabilizer + 1
|
||||||
|
|
|
@ -12,7 +12,6 @@ var main
|
||||||
func _ready():
|
func _ready():
|
||||||
player = get_node(@"../../Player")
|
player = get_node(@"../../Player")
|
||||||
main = get_node(@"../../")
|
main = get_node(@"../../")
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
rotate_y(delta)
|
rotate_y(delta)
|
||||||
|
|
Loading…
Reference in New Issue