Add incomplete hunger system
This commit is contained in:
parent
f868b86f10
commit
ff388ee079
BIN
assets/icons/stomach.png
Normal file
BIN
assets/icons/stomach.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
35
assets/icons/stomach.png.import
Normal file
35
assets/icons/stomach.png.import
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/stomach.png-43f18e7236b051f708f6adff5e1822c4.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/icons/stomach.png"
|
||||||
|
dest_files=[ "res://.import/stomach.png-43f18e7236b051f708f6adff5e1822c4.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
|
@ -43,7 +43,8 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"timeline-1660443870.json",
|
"timeline-1660443870.json",
|
||||||
"timeline-1660444277.json",
|
"timeline-1660444277.json",
|
||||||
"timeline-1660454153.json"
|
"timeline-1660454153.json",
|
||||||
|
"timeline-1660463789.json"
|
||||||
],
|
],
|
||||||
"folders": {
|
"folders": {
|
||||||
|
|
||||||
|
15
dialogic/timelines/timeline-1660463789.json
Normal file
15
dialogic/timelines/timeline-1660463789.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"events": [
|
||||||
|
{
|
||||||
|
"character": "",
|
||||||
|
"event_id": "dialogic_001",
|
||||||
|
"portrait": "",
|
||||||
|
"text": "Looks like you've starved to death.\nBetter luck next time!"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"dialogic-version": "1.4.4",
|
||||||
|
"file": "timeline-1660463789.json",
|
||||||
|
"name": "starve"
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,8 @@
|
|||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://scripts/Player.gd" type="Script" id=1]
|
[ext_resource path="res://scripts/Player.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://assets/protodungman/DungMan.glb" type="PackedScene" id=2]
|
[ext_resource path="res://assets/protodungman/DungMan.glb" type="PackedScene" id=2]
|
||||||
|
[ext_resource path="res://assets/icons/stomach.png" type="Texture" id=3]
|
||||||
|
|
||||||
[sub_resource type="BoxShape" id=3]
|
[sub_resource type="BoxShape" id=3]
|
||||||
extents = Vector3( 0.25, 0.25, 1 )
|
extents = Vector3( 0.25, 0.25, 1 )
|
||||||
@ -30,3 +31,47 @@ shape = SubResource( 2 )
|
|||||||
[node name="Camera" type="Camera" parent="."]
|
[node name="Camera" type="Camera" parent="."]
|
||||||
transform = Transform( 1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 0, 5.44166, 3.39746 )
|
transform = Transform( 1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 0, 5.44166, 3.39746 )
|
||||||
fov = 50.0
|
fov = 50.0
|
||||||
|
|
||||||
|
[node name="UI" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
[node name="Control" type="Control" parent="UI"]
|
||||||
|
margin_right = 40.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="UI/Control"]
|
||||||
|
margin_right = 128.0
|
||||||
|
margin_bottom = 128.0
|
||||||
|
custom_constants/margin_right = 16
|
||||||
|
custom_constants/margin_top = 16
|
||||||
|
custom_constants/margin_left = 16
|
||||||
|
custom_constants/margin_bottom = 16
|
||||||
|
|
||||||
|
[node name="stomachs" type="HBoxContainer" parent="UI/Control/MarginContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
margin_left = 16.0
|
||||||
|
margin_top = 16.0
|
||||||
|
margin_right = 540.0
|
||||||
|
margin_bottom = 144.0
|
||||||
|
|
||||||
|
[node name="stomach0" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"]
|
||||||
|
margin_right = 128.0
|
||||||
|
margin_bottom = 128.0
|
||||||
|
texture = ExtResource( 3 )
|
||||||
|
|
||||||
|
[node name="stomach1" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"]
|
||||||
|
margin_left = 132.0
|
||||||
|
margin_right = 260.0
|
||||||
|
margin_bottom = 128.0
|
||||||
|
texture = ExtResource( 3 )
|
||||||
|
|
||||||
|
[node name="stomach2" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"]
|
||||||
|
margin_left = 264.0
|
||||||
|
margin_right = 392.0
|
||||||
|
margin_bottom = 128.0
|
||||||
|
texture = ExtResource( 3 )
|
||||||
|
|
||||||
|
[node name="stomach3" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"]
|
||||||
|
margin_left = 396.0
|
||||||
|
margin_right = 524.0
|
||||||
|
margin_bottom = 128.0
|
||||||
|
texture = ExtResource( 3 )
|
||||||
|
@ -4,6 +4,7 @@ const EPSILON = 0.0001
|
|||||||
const SPEED = 3.0
|
const SPEED = 3.0
|
||||||
|
|
||||||
export var inventory = { "ore" : 0 }
|
export var inventory = { "ore" : 0 }
|
||||||
|
var health: int = 4 setget set_health
|
||||||
|
|
||||||
# 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():
|
||||||
@ -16,6 +17,19 @@ func _physics_process(delta):
|
|||||||
$DungMan.look_at(global_transform.origin - motion, Vector3.UP)
|
$DungMan.look_at(global_transform.origin - motion, Vector3.UP)
|
||||||
move_and_slide(motion)
|
move_and_slide(motion)
|
||||||
|
|
||||||
|
func set_health(new_value):
|
||||||
|
health = min(new_value, 4)
|
||||||
|
for child in $"%stomachs".get_children():
|
||||||
|
child.visible = child.get_index() < health
|
||||||
|
if health <= 0:
|
||||||
|
var node = Dialogic.start("starve")
|
||||||
|
node.pause_mode = PAUSE_MODE_PROCESS
|
||||||
|
add_child(node)
|
||||||
|
get_tree().paused = true
|
||||||
|
yield(node, "timeline_end")
|
||||||
|
get_tree().paused = false
|
||||||
|
get_tree().quit() # go back to main menu when such a thing exists
|
||||||
|
|
||||||
func can_afford(item_name, item_amount):
|
func can_afford(item_name, item_amount):
|
||||||
assert(item_amount > 0)
|
assert(item_amount > 0)
|
||||||
var current_amount : int = 0
|
var current_amount : int = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user