diff --git a/AntiDepressant.gd b/AntiDepressant.gd new file mode 100644 index 0000000..5557cec --- /dev/null +++ b/AntiDepressant.gd @@ -0,0 +1,27 @@ +extends Area + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + +var player + + +# Called when the node enters the scene tree for the first time. +func _ready(): + player = get_node(@"../../../Player") + #pass # Replace with function body. + +func _physics_process(delta): + rotate_y(delta) + + if(overlaps_body(player)): + player.addAntiDepressant() + queue_free() + + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass diff --git a/Camera.gd b/Camera.gd new file mode 100644 index 0000000..fadcb07 --- /dev/null +++ b/Camera.gd @@ -0,0 +1,66 @@ +extends Camera + + +# Depression +var downForceStrength = 0 + +#Mania +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 (NodePath) var target # Assign the node this camera will follow. + +var trauma = 0.0 # Current shake strength. +var trauma_power = 2 # Trauma exponent. Use [2, 3]. + +var downForce = false; + +onready var noise = OpenSimplexNoise.new() +var noise_y = 0 + +var pivot + +# Called when the node enters the scene tree for the first time. +func _ready(): + randomize() + noise.seed = randi() + noise.period = 4 + noise.octaves = 2 + pivot = get_parent(); + + +func changeShaking(setTrauma): + trauma = setTrauma + +func changeDownForce(force): + downForceStrength = force + + +func _process(delta): +# if target: +# global_position = get_node(target).global_position + if trauma: + shake() + + if downForceStrength<0: + if(pivot.rotation.x > -1.4): + #print(pivot.rotation.x) + pivot.rotate_x(downForceStrength) + + + +func shake(): + var amount = pow(trauma, trauma_power) + noise_y += 1 + # 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) + 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(): + trauma = 0 + downForce=false + downForceStrength = 0; diff --git a/Candle.gd b/Candle.gd new file mode 100644 index 0000000..598a3e4 --- /dev/null +++ b/Candle.gd @@ -0,0 +1,26 @@ +extends OmniLight + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + +var _noise = OpenSimplexNoise.new() + + +# Called when the node enters the scene tree for the first time. +func _ready(): + randomize() + # Configure the OpenSimplexNoise instance. + _noise.seed = randi() + _noise.octaves = 4 + _noise.period = 20.0 + _noise.persistence = 0.8 + + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + if(OS.get_ticks_msec()%100<10): + light_energy = 1 + _noise.get_noise_1d(OS.get_ticks_msec()) + diff --git a/HUD.gd b/HUD.gd new file mode 100644 index 0000000..6d9ec3d --- /dev/null +++ b/HUD.gd @@ -0,0 +1,23 @@ +extends CanvasLayer + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# 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 showAntiDep(count): + $AntiDep.text = count + $AntiDep.show() + +func showMoodStab(count): + $MoodStab.text = count + $MoodStab.show() diff --git a/Main.gd b/Main.gd new file mode 100644 index 0000000..73391b9 --- /dev/null +++ b/Main.gd @@ -0,0 +1,278 @@ +extends Node + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + +var wantToQuit = false + +var mood = 0 #[-1,+1] + +#taken pills that effects current state +var antiDep = 0 +var moodStab = 0 + +var vision +var player + +var averageDownPhase = 3 +var averageUpPhase = 2 +var averageStable = 2 + +var stableTimer +var maniaTimer +var depressionTimer + +#var moodStabilizerTimer +#var antiDepressantTimer + +var secondsPerWeek = 10 + +var rng = RandomNumberGenerator.new() + +var hudMood +var hudAnti +var hudStab + +var takingPill = false + +#smoothing curves points +var p0 = 0 +var p1 = 0 + +var t = 0.0 + + +var sun + + +# Called when the node enters the scene tree for the first time. +func _ready(): + vision = $Player/CameraPivot/Camera + player = $Player + sun = $Lighting/Sun + hudMood = $HUD/debug/Mood + hudAnti = $HUD/debug/AntiDepActive + hudStab = $HUD/debug/MoodStabActive + + + stableTimer = $Timer/StableTimer + maniaTimer = $Timer/ManiaTimer + 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") + maniaTimer.connect("timeout", self, "_on_ManiaTimer_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.start() + print("stabletimer started with waitime: ",stableTimer.get_wait_time()) + + +func _input(event): + if Input.is_action_pressed("click"): + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + wantToQuit = false + + if Input.is_action_just_released("depression"): + #take antidepressend + if(takingPill): + pass + else: + if(player.getAntiDepressant()>0): + player.takeAntiDepressant() + antiDep = antiDep + 1 + var antiDepressantTimer = Timer.new() + antiDepressantTimer.one_shot = true + antiDepressantTimer.set_wait_time(secondsPerWeek*averageDownPhase/2) + add_child(antiDepressantTimer) + antiDepressantTimer.connect("timeout", self, "_on_AntiDepressantTimer_timeout") + antiDepressantTimer.start() + print("antiDepressantTimer started with waitime: ",antiDepressantTimer.get_wait_time()) + + + + takingPill = true + yield(get_tree().create_timer(1.0), "timeout") + takingPill = false + + if Input.is_action_just_released("mania"): + if(takingPill): + pass + else: + if(player.getMoodStabilizer()>0): + player.takeMoodStabilizer() + moodStab = moodStab + 1 + var moodStabilizerTimer = Timer.new() + moodStabilizerTimer.one_shot = true; + moodStabilizerTimer.set_wait_time(secondsPerWeek*averageUpPhase/2) + add_child(moodStabilizerTimer) + moodStabilizerTimer.connect("timeout", self, "_on_MoodStabilizerTimer_timeout") + moodStabilizerTimer.start() + print("moodStabilizerTimer started with waitime: ",moodStabilizerTimer.get_wait_time()) + + takingPill = true + yield(get_tree().create_timer(1.0), "timeout") + takingPill = false + if Input.is_action_pressed("reset"): + mood = 0 + vision.reset() + player.setNormal() + changeEffectsByMood() + + if Input.is_action_pressed("quit"): + if wantToQuit && Input.get_mouse_mode()==Input.MOUSE_MODE_CONFINED: + get_tree().quit() + else: + if Input.get_mouse_mode()==Input.MOUSE_MODE_CONFINED: + wantToQuit = true + else: + Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED) + + if Input.is_action_just_released("flashlight"): + if($Player/CameraPivot/Flashlight.visible): + $Player/CameraPivot/Flashlight.visible = false + else: + $Player/CameraPivot/Flashlight.visible = true + + + + + +func changeEffectsByMood(): + + #depression + if(mood<0): + player.setDepressed(1+(1*abs(mood))) + #regulare med + if(antiDep>0): + vision.changeDownForce(0) + player.setDepressed(1) + #overdose of regulare med + if(antiDep>1): + vision.changeDownForce(+0.005*antiDep) + #none regular med + if(antiDep==0): + vision.changeDownForce(-0.005*abs(mood)) + + #wrong med + if(moodStab>0): + vision.changeShaking(1*moodStab) + #none wrong med + else: + vision.changeShaking(0) + + + + #mania + if (mood>0): + #wrong med + if(antiDep>0): + player.setDepressed(1*antiDep) + else: + player.setManic(1+(1*mood)) + + #regulare med + if(moodStab>0): + vision.changeShaking(0) + #overdose regulare med + if(moodStab>1): + player.setManic(2) + if(moodStab==0): + vision.changeShaking(1*mood) + + vision.changeDownForce(0) + + #stable + if (mood==0): + vision.changeDownForce(mood) + vision.changeShaking(mood) + vision.reset() + player.setNormal() + + if(antiDep>0): + player.setDepressed(1*antiDep) + + if(moodStab>0): + vision.changeShaking(1*moodStab) + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + smoothMood(delta/secondsPerWeek*0.7) + + changeEffectsByMood() + + sun.rotate_x(delta) + + + hudMood.text = String(mood) + hudAnti.text = String(antiDep) + hudStab.text = String(moodStab) + + + +func _on_StableTimer_timeout(): + print("StableTimer_timeout") + #mood = -1 + p0 = 0 + p1 = -1 + t = 0 + depressionTimer.set_wait_time(secondsPerWeek*averageDownPhase+rng.randf_range(-secondsPerWeek/5,+secondsPerWeek/5)) + depressionTimer.start() + print("depressionTimer started with waitime: ",depressionTimer.get_wait_time()) + + +func _on_ManiaTimer_timeout(): + print("ManiaTimer_timeout") + #mood = 0 + p0 = 1 + p1 = 0 + t = 0 + stableTimer.set_wait_time(secondsPerWeek*averageStable+rng.randf_range(-secondsPerWeek/5,+secondsPerWeek/5)) + stableTimer.start() + print("stabletimer started with waitime: ",stableTimer.get_wait_time()) + +func _on_DepressionTimer_timeout(): + print("DepressionTimer_timeout") + #mood = +1 + p0 = -1 + p1 = +1 + t = 0 + maniaTimer.set_wait_time(secondsPerWeek*averageUpPhase+rng.randf_range(-secondsPerWeek/5,+secondsPerWeek/5)) + maniaTimer.start() + print("maniaTimer started with waitime: ",maniaTimer.get_wait_time()) + +func _on_AntiDepressantTimer_timeout(): + print("AntiDepressantTimer_timeout") + antiDep = antiDep - 1 + +func _on_MoodStabilizerTimer_timeout(): + print("MoodStabilizerTimer_timeout") + moodStab = moodStab - 1 + +func takingpill(): + takingPill = false + +func smoothMood(deltaTime: float): + #print(p0," ",p1) + t += deltaTime + if(t>1): + t=1 + if(t<-1): + t=-1 + mood = p0 * (1 - t) + p1 * t + #print(mood) diff --git a/Main.tscn b/Main.tscn new file mode 100644 index 0000000..a13b239 --- /dev/null +++ b/Main.tscn @@ -0,0 +1,376 @@ +[gd_scene load_steps=31 format=2] + +[ext_resource path="res://Player.gd" type="Script" id=1] +[ext_resource path="res://Camera.gd" type="Script" id=2] +[ext_resource path="res://Main.gd" type="Script" id=3] +[ext_resource path="res://assets/ground.png" type="Texture" id=4] +[ext_resource path="res://MoodStabilizer.gd" type="Script" id=5] +[ext_resource path="res://AntiDepressant.gd" type="Script" id=6] +[ext_resource path="res://HUD.gd" type="Script" id=7] +[ext_resource path="res://Candle.gd" type="Script" id=8] + +[sub_resource type="CubeMesh" id=1] + +[sub_resource type="SpatialMaterial" id=6] +albedo_texture = ExtResource( 4 ) +uv1_scale = Vector3( 10, 10, 10 ) +uv1_triplanar = true +uv2_triplanar = true + +[sub_resource type="BoxShape" id=2] + +[sub_resource type="CapsuleShape" id=3] + +[sub_resource type="CapsuleMesh" id=11] + +[sub_resource type="SpatialMaterial" id=12] +albedo_color = Color( 1, 0.890196, 0, 1 ) + +[sub_resource type="CapsuleShape" id=13] + +[sub_resource type="CapsuleMesh" id=9] + +[sub_resource type="SpatialMaterial" id=10] +albedo_color = Color( 0.85098, 0, 1, 1 ) + +[sub_resource type="CapsuleShape" id=8] + +[sub_resource type="CubeMesh" id=4] + +[sub_resource type="BoxShape" id=5] + +[sub_resource type="CubeMesh" id=14] + +[sub_resource type="BoxShape" id=15] + +[sub_resource type="ParticlesMaterial" id=18] +emission_shape = 5 +emission_ring_radius = 2.0 +emission_ring_inner_radius = 0.0 +emission_ring_height = 1.0 +emission_ring_axis = Vector3( 0, 0, 1 ) +gravity = Vector3( 0, 9.8, 0 ) +initial_velocity = 1.0 +initial_velocity_random = 1.0 +anim_speed_random = 0.47 + +[sub_resource type="SpatialMaterial" id=19] +albedo_color = Color( 1, 0.4, 0, 1 ) +emission_enabled = true +emission = Color( 1, 0.117647, 0, 1 ) +emission_energy = 1.0 +emission_operator = 0 +emission_on_uv2 = false + +[sub_resource type="SphereMesh" id=20] +material = SubResource( 19 ) +radius = 0.311 +height = 2.024 +is_hemisphere = true + +[sub_resource type="CubeMesh" id=21] + +[sub_resource type="BoxShape" id=22] + +[sub_resource type="CapsuleMesh" id=7] + +[sub_resource type="PanoramaSky" id=17] + +[sub_resource type="Environment" id=16] +background_sky = SubResource( 17 ) +ambient_light_color = Color( 0.0470588, 0.0470588, 0.0470588, 1 ) +ambient_light_energy = 1.45 +ambient_light_sky_contribution = 0.0 + +[node name="Main" type="Node"] +script = ExtResource( 3 ) + +[node name="Ground" type="StaticBody" parent="."] +transform = Transform( 500, 0, 0, 0, 1, 0, 0, 0, 500, 0, -1, 0 ) + +[node name="MeshInstance" type="MeshInstance" parent="Ground"] +mesh = SubResource( 1 ) +material/0 = SubResource( 6 ) + +[node name="CollisionShape" type="CollisionShape" parent="Ground"] +shape = SubResource( 2 ) + +[node name="Player" type="KinematicBody" parent="."] +script = ExtResource( 1 ) + +[node name="CollisionShape" type="CollisionShape" parent="Player"] +transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 1.68515, 0 ) +shape = SubResource( 3 ) + +[node name="CameraPivot" type="Position3D" parent="Player"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.36526, 0 ) + +[node name="Camera" type="Camera" parent="Player/CameraPivot"] +script = ExtResource( 2 ) + +[node name="Flashlight" type="SpotLight" parent="Player/CameraPivot"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.392762, -0.758436 ) +shadow_enabled = true +spot_range = 30.0 +spot_attenuation = 4.14106 + +[node name="Collectibles" type="Node" parent="."] + +[node name="AntiDepressants" type="Node" parent="Collectibles"] + +[node name="AntiDepressant" type="Area" parent="Collectibles/AntiDepressants"] +transform = Transform( 0.5, 0, 0, 0, 0.353553, -0.353553, 0, 0.353553, 0.353553, -16.9333, 1.3376, 0 ) +script = ExtResource( 6 ) + +[node name="MeshInstance" type="MeshInstance" parent="Collectibles/AntiDepressants/AntiDepressant"] +mesh = SubResource( 11 ) +material/0 = SubResource( 12 ) + +[node name="CollisionShape" type="CollisionShape" parent="Collectibles/AntiDepressants/AntiDepressant"] +shape = SubResource( 13 ) + +[node name="Timer" type="Timer" parent="Collectibles/AntiDepressants/AntiDepressant"] +one_shot = true + +[node name="AntiDepressant2" type="Area" parent="Collectibles/AntiDepressants"] +transform = Transform( 0.5, 0, 0, 0, 0.353553, -0.353553, 0, 0.353553, 0.353553, -16.9333, 1.3376, 5.39893 ) +script = ExtResource( 6 ) + +[node name="MeshInstance" type="MeshInstance" parent="Collectibles/AntiDepressants/AntiDepressant2"] +mesh = SubResource( 11 ) +material/0 = SubResource( 12 ) + +[node name="CollisionShape" type="CollisionShape" parent="Collectibles/AntiDepressants/AntiDepressant2"] +shape = SubResource( 13 ) + +[node name="Timer" type="Timer" parent="Collectibles/AntiDepressants/AntiDepressant2"] +one_shot = true + +[node name="MoodStabilizers" type="Node" parent="Collectibles"] + +[node name="MoodStabilizer" type="Area" parent="Collectibles/MoodStabilizers"] +transform = Transform( 0.5, 0, 0, 0, 0.353553, -0.353553, 0, 0.353553, 0.353553, 2.9262, 5.87371, -5.98535 ) +script = ExtResource( 5 ) + +[node name="MeshInstance" type="MeshInstance" parent="Collectibles/MoodStabilizers/MoodStabilizer"] +mesh = SubResource( 9 ) +skeleton = NodePath("") +material/0 = SubResource( 10 ) + +[node name="CollisionShape" type="CollisionShape" parent="Collectibles/MoodStabilizers/MoodStabilizer"] +shape = SubResource( 8 ) + +[node name="Timer" type="Timer" parent="Collectibles/MoodStabilizers/MoodStabilizer"] +one_shot = true + +[node name="MoodStabilizer2" type="Area" parent="Collectibles/MoodStabilizers"] +transform = Transform( 0.5, 0, 0, 0, 0.353553, -0.353553, 0, 0.353553, 0.353553, 2.9262, 5.87371, -8.70988 ) +script = ExtResource( 5 ) + +[node name="MeshInstance" type="MeshInstance" parent="Collectibles/MoodStabilizers/MoodStabilizer2"] +mesh = SubResource( 9 ) +skeleton = NodePath("") +material/0 = SubResource( 10 ) + +[node name="CollisionShape" type="CollisionShape" parent="Collectibles/MoodStabilizers/MoodStabilizer2"] +shape = SubResource( 8 ) + +[node name="Timer" type="Timer" parent="Collectibles/MoodStabilizers/MoodStabilizer2"] +one_shot = true + +[node name="HUD" type="CanvasLayer" parent="."] +script = ExtResource( 7 ) + +[node name="AntiDep" type="Label" parent="HUD"] +margin_left = 127.0 +margin_top = 570.0 +margin_right = 167.0 +margin_bottom = 584.0 +text = "0" + +[node name="MoodStab" type="Label" parent="HUD"] +margin_left = 983.0 +margin_top = 570.0 +margin_right = 1023.0 +margin_bottom = 584.0 +text = "0" + +[node name="AntiDepText" type="Label" parent="HUD"] +margin_left = 15.0 +margin_top = 570.0 +margin_right = 119.0 +margin_bottom = 584.0 +text = "Anti-Depressant:" + +[node name="MoodStabText" type="Label" parent="HUD"] +margin_left = 874.0 +margin_top = 571.0 +margin_right = 973.0 +margin_bottom = 585.0 +text = "Mood Stabilizer:" + +[node name="debug" type="Node" parent="HUD"] + +[node name="Mood" type="Label" parent="HUD/debug"] +margin_right = 40.0 +margin_bottom = 14.0 +text = "0" + +[node name="AntiDepActive" type="Label" parent="HUD/debug"] +margin_top = 15.0 +margin_right = 40.0 +margin_bottom = 29.0 +text = "0" + +[node name="MoodStabActive" type="Label" parent="HUD/debug"] +margin_top = 29.0 +margin_right = 40.0 +margin_bottom = 43.0 +text = "0" + +[node name="Obstacles" type="Node" parent="."] + +[node name="Cube" type="StaticBody" parent="Obstacles"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.38033, -7.65238 ) + +[node name="MeshInstance" type="MeshInstance" parent="Obstacles/Cube"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.3771, 0 ) +mesh = SubResource( 4 ) +material/0 = null + +[node name="CollisionShape" type="CollisionShape" parent="Obstacles/Cube"] +shape = SubResource( 5 ) + +[node name="Cube2" type="StaticBody" parent="Obstacles"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 4.48708, 3.53697, -7.65238 ) + +[node name="MeshInstance" type="MeshInstance" parent="Obstacles/Cube2"] +mesh = SubResource( 4 ) +material/0 = null + +[node name="CollisionShape" type="CollisionShape" parent="Obstacles/Cube2"] +shape = SubResource( 5 ) + +[node name="house" type="Node" parent="Obstacles"] + +[node name="wall" type="StaticBody" parent="Obstacles/house"] +transform = Transform( -4.37114e-07, 0, 1, 0, 5, 0, -10, 0, -4.37114e-08, -12, 5, 25 ) + +[node name="MeshInstance" type="MeshInstance" parent="Obstacles/house/wall"] +transform = Transform( 1, 0, -4.44089e-16, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) +mesh = SubResource( 14 ) +material/0 = null + +[node name="CollisionShape" type="CollisionShape" parent="Obstacles/house/wall"] +shape = SubResource( 15 ) + +[node name="wall2" type="StaticBody" parent="Obstacles/house"] +transform = Transform( -4.37114e-07, 0, 1, 0, 5, 0, -10, 0, -4.37114e-08, 6, 5, 25 ) + +[node name="MeshInstance" type="MeshInstance" parent="Obstacles/house/wall2"] +transform = Transform( 1, 0, -4.44089e-16, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) +mesh = SubResource( 14 ) +material/0 = null + +[node name="CollisionShape" type="CollisionShape" parent="Obstacles/house/wall2"] +shape = SubResource( 15 ) + +[node name="wall3" type="StaticBody" parent="Obstacles/house"] +transform = Transform( 10, 0, 0, 0, 5, 0, 0, 0, 1, -3, 5, 34 ) + +[node name="MeshInstance" type="MeshInstance" parent="Obstacles/house/wall3"] +transform = Transform( 1, 0, -4.44089e-16, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) +mesh = SubResource( 14 ) +material/0 = null + +[node name="CollisionShape" type="CollisionShape" parent="Obstacles/house/wall3"] +shape = SubResource( 15 ) + +[node name="table" type="StaticBody" parent="Obstacles/house"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 1, 30 ) + +[node name="candle" type="StaticBody" parent="Obstacles/house/table"] +transform = Transform( 0.1, 0, 0, 0, 0.3, 0, 0, 0, 0.1, 0, 1.3, 0 ) + +[node name="MeshInstance" type="MeshInstance" parent="Obstacles/house/table/candle"] +transform = Transform( 1, 0, -4.44089e-16, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) +mesh = SubResource( 14 ) +material/0 = null + +[node name="CollisionShape" type="CollisionShape" parent="Obstacles/house/table/candle"] +shape = SubResource( 15 ) + +[node name="Candle" type="OmniLight" parent="Obstacles/house/table/candle"] +transform = Transform( 10, 0, 0, 0, 3.33333, 0, 0, 0, 10, 0, 1.62651, 0 ) +light_color = Color( 1, 0.4, 0, 1 ) +shadow_enabled = true +omni_range = 3.685 +script = ExtResource( 8 ) + +[node name="Particles" type="Particles" parent="Obstacles/house/table/candle"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.97687, 0 ) +cast_shadow = 0 +process_material = SubResource( 18 ) +draw_pass_1 = SubResource( 20 ) + +[node name="wick" type="StaticBody" parent="Obstacles/house/table/candle"] +transform = Transform( 0.1, 0, 0, 0, 0.3, 0, 0, 0, 0.1, 0, 1.20929, 0 ) + +[node name="MeshInstance" type="MeshInstance" parent="Obstacles/house/table/candle/wick"] +mesh = SubResource( 21 ) +material/0 = null + +[node name="CollisionShape" type="CollisionShape" parent="Obstacles/house/table/candle/wick"] +shape = SubResource( 22 ) + +[node name="MeshInstance" type="MeshInstance" parent="Obstacles/house/table"] +transform = Transform( 1, 0, -4.44089e-16, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) +mesh = SubResource( 14 ) +material/0 = null + +[node name="CollisionShape" type="CollisionShape" parent="Obstacles/house/table"] +shape = SubResource( 15 ) + +[node name="roof" type="StaticBody" parent="Obstacles/house"] +transform = Transform( 10, 0, 0, 0, -4.37114e-07, -1, 0, 10, -4.37114e-08, -3, 9, 25 ) + +[node name="MeshInstance" type="MeshInstance" parent="Obstacles/house/roof"] +transform = Transform( 1, 0, -4.44089e-16, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) +mesh = SubResource( 14 ) +material/0 = null + +[node name="CollisionShape" type="CollisionShape" parent="Obstacles/house/roof"] +shape = SubResource( 15 ) + +[node name="Lighting" type="Node" parent="."] + +[node name="SpotLight" type="SpotLight" parent="Lighting"] +transform = Transform( 1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 0, 13.7321, 0 ) +light_energy = 1.175 +shadow_enabled = true +spot_range = 32.621 + +[node name="MeshInstance" type="MeshInstance" parent="Lighting/SpotLight"] +transform = Transform( 0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, 0, 0 ) +mesh = SubResource( 7 ) +material/0 = null + +[node name="Sun" type="DirectionalLight" parent="Lighting"] +transform = Transform( 0.906308, -0.397131, 0.144544, 0, 0.34202, 0.939693, -0.422618, -0.851651, 0.309975, 0, 58.3521, 1.32686 ) +light_color = Color( 1, 0.964706, 0.858824, 1 ) +light_energy = 0.706 +shadow_enabled = true + +[node name="Timer" type="Node" parent="."] + +[node name="StableTimer" type="Timer" parent="Timer"] +one_shot = true + +[node name="ManiaTimer" type="Timer" parent="Timer"] +one_shot = true + +[node name="DepressionTimer" type="Timer" parent="Timer"] +one_shot = true + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource( 16 ) diff --git a/MoodStabilizer.gd b/MoodStabilizer.gd new file mode 100644 index 0000000..913e3a7 --- /dev/null +++ b/MoodStabilizer.gd @@ -0,0 +1,26 @@ +extends Area + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + +var player + + +# Called when the node enters the scene tree for the first time. +func _ready(): + player = get_node(@"../../../Player") + #pass # Replace with function body. + +func _physics_process(delta): + rotate_y(delta) + + if(overlaps_body(player)): + player.addMoodStabilizer() + queue_free() + + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass diff --git a/Player.gd b/Player.gd new file mode 100644 index 0000000..ef09541 --- /dev/null +++ b/Player.gd @@ -0,0 +1,183 @@ +extends KinematicBody + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + +var MAX_SPEED = 7 +var ACCEL = 3.5 +var DEACCEL= 16 +var MAX_SLOPE_ANGLE = 40 + +# The downward acceleration when in the air, in meters per second squared. +export var fall_acceleration = 75 + +export var jump_impulse = 22 + +var velocity = Vector3.ZERO + +var rotation_helper + +var MOUSE_SENSITIVITY = 0.05 + +onready var camera = $CameraPivot/Camera + +var vel = Vector3() +var dir = Vector3() + +#medicine +var moodStabilizer = 0 +var antiDepressant = 0 + +var hud + +func _process(_delta): + pass + + +func _physics_process(delta): + # We create a local variable to store the input direction. + dir = Vector3() + var cam_xform = camera.get_global_transform() + + var input_movement_vector = Vector2() + + # We check for each move input and update the direction accordingly. + if Input.is_action_pressed("move_right"): + input_movement_vector.x += 1 + if Input.is_action_pressed("move_left"): + input_movement_vector.x -= 1 + if Input.is_action_pressed("move_back"): + # Notice how we are working with the vector's x and z axes. + # In 3D, the XZ plane is the ground plane. + input_movement_vector.y -= 1 + if Input.is_action_pressed("move_forward"): + input_movement_vector.y += 1 + + input_movement_vector = input_movement_vector.normalized() + + dir += -cam_xform.basis.z.normalized() * input_movement_vector.y + dir += cam_xform.basis.x.normalized() * input_movement_vector.x + + + dir.y = 0 + dir = dir.normalized() + + + + var hvel = vel + hvel.y = 0 + + var target = dir + target *= MAX_SPEED + + var accel + if dir.dot(hvel) > 0: + accel = ACCEL + else: + accel = DEACCEL + + hvel = hvel.linear_interpolate(target, accel * delta) + vel.x = hvel.x + vel.z = hvel.z + + vel.y -= fall_acceleration * delta + + + if is_on_floor() and Input.is_action_just_pressed("jump"): + vel.y += jump_impulse + + 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): + if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED: + rotation_helper.rotate_x(deg2rad(event.relative.y * MOUSE_SENSITIVITY * -1)) + self.rotate_y(deg2rad(event.relative.x * MOUSE_SENSITIVITY * -1)) + + var camera_rot = rotation_helper.rotation_degrees + camera_rot.x = clamp(camera_rot.x, -90, 90) + rotation_helper.rotation_degrees = camera_rot + +func setManic(multiplyer): + MAX_SPEED = 12 + ACCEL = 2.75 * multiplyer + DEACCEL= 4 * multiplyer + MAX_SLOPE_ANGLE = 40 + fall_acceleration = 75 + jump_impulse = 16 * multiplyer + MOUSE_SENSITIVITY = 0.2 * multiplyer + +func setNormal(): + MAX_SPEED = 7 + ACCEL = 3.5 + DEACCEL= 16 + MAX_SLOPE_ANGLE = 40 + fall_acceleration = 75 + jump_impulse = 22 + MOUSE_SENSITIVITY = 0.05 + +func setDepressed(multiplyer): + MAX_SPEED = 4 / multiplyer + ACCEL = 1 / multiplyer + DEACCEL= 64 / multiplyer + MAX_SLOPE_ANGLE = 40 + fall_acceleration = 75 + jump_impulse = 22 / multiplyer + MOUSE_SENSITIVITY = 0.02 / multiplyer + +# Called when the node enters the scene tree for the first time. +func _ready(): + rotation_helper = $CameraPivot + 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(): + moodStabilizer = moodStabilizer + 1 + print("current mood stabilizer: ", moodStabilizer) + hud.showMoodStab(String(moodStabilizer)) + +func addAntiDepressant(): + antiDepressant = antiDepressant + 1 + print("current anti depressant: ", antiDepressant) + hud.showAntiDep(String(antiDepressant)) + +func takeMoodStabilizer(): + if(moodStabilizer>0): + moodStabilizer = moodStabilizer - 1 + + print("current mood stabilizer: ", moodStabilizer) + hud.showMoodStab(String(moodStabilizer)) + +func takeAntiDepressant(): + if(antiDepressant>0): + antiDepressant = antiDepressant - 1 + + print("current anti depressant: ", antiDepressant) + hud.showAntiDep(String(antiDepressant)) + +func getMoodStabilizer(): + return moodStabilizer + +func getAntiDepressant(): + return antiDepressant diff --git a/assets/ground.png b/assets/ground.png new file mode 100644 index 0000000..5c417a6 Binary files /dev/null and b/assets/ground.png differ diff --git a/assets/ground.png.import b/assets/ground.png.import new file mode 100644 index 0000000..7a99c60 --- /dev/null +++ b/assets/ground.png.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="StreamTexture" +path.s3tc="res://.import/ground.png-328d82a69941a655cdd4638d3455ed11.s3tc.stex" +path.etc2="res://.import/ground.png-328d82a69941a655cdd4638d3455ed11.etc2.stex" +metadata={ +"imported_formats": [ "s3tc", "etc2" ], +"vram_texture": true +} + +[deps] + +source_file="res://assets/ground.png" +dest_files=[ "res://.import/ground.png-328d82a69941a655cdd4638d3455ed11.s3tc.stex", "res://.import/ground.png-328d82a69941a655cdd4638d3455ed11.etc2.stex" ] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=true +flags/filter=true +flags/mipmaps=true +flags/anisotropic=false +flags/srgb=1 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/default_env.tres b/default_env.tres new file mode 100644 index 0000000..20207a4 --- /dev/null +++ b/default_env.tres @@ -0,0 +1,7 @@ +[gd_resource type="Environment" load_steps=2 format=2] + +[sub_resource type="ProceduralSky" id=1] + +[resource] +background_mode = 2 +background_sky = SubResource( 1 ) diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..0e2d7f3 --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,24 @@ +[preset.0] + +name="Linux/X11" +platform="Linux/X11" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path=".export/linux/game.x86_64" +script_export_mode=1 +script_encryption_key="" + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +binary_format/64_bits=true +binary_format/embed_pck=false +texture_format/bptc=false +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +texture_format/no_bptc_fallbacks=true diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..c98fbb6 Binary files /dev/null and b/icon.png differ diff --git a/icon.png.import b/icon.png.import new file mode 100644 index 0000000..a4c02e6 --- /dev/null +++ b/icon.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.png" +dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..76069bc --- /dev/null +++ b/project.godot @@ -0,0 +1,107 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=4 + +[application] + +config/name="AShadowWithoutLight" +run/main_scene="res://Main.tscn" +config/icon="res://icon.png" + +[global] + +shadow=false + +[input] + +move_left={ +"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":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null) + ] +} +move_right={ +"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":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null) + ] +} +move_forward={ +"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":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null) + ] +} +move_back={ +"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":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null) + ] +} +jump={ +"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":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null) + ] +} +quit={ +"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) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null) + ] +} +mania={ +"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":69,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null) + ] +} +depression={ +"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":81,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":false,"script":null) + ] +} +flashlight={ +"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":70,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null) + ] +} +click={ +"deadzone": 0.5, +"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) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":5,"pressure":0.0,"pressed":false,"script":null) + ] +} +reset={ +"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":82,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":4,"pressure":0.0,"pressed":false,"script":null) + ] +} + +[physics] + +common/enable_pause_aware_picking=true + +[rendering] + +quality/directional_shadow/size=8192 +quality/directional_shadow/size.mobile=4096 +quality/shadow_atlas/size=8192 +quality/shadow_atlas/size.mobile=4096 +quality/shadow_atlas/cubemap_size=1024 +quality/shadows/filter_mode=2 +quality/shadows/filter_mode.mobile=2 +environment/default_environment="res://default_env.tres"