Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions first-person-ascii-art-demo/Interactables/FirePedestal.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,29 @@ signal off


func _ready():
pass
# animation_player.seek(0.0, true)
if lit:
particles.emitting = true


func handle_command(command,interaction_caller):
# todo: probably can light the same pillar 3 times right now
if animation_player.is_playing():
return false

print(interaction_caller.item_in_inventory)
# If player has a torch
if (command == "light" or 1 == 1) and \
not interaction_caller.item_in_inventory == null and \
interaction_caller.item_in_inventory.is_in_group("fire") and \
interaction_caller.item_in_inventory.get("on") == true:
interaction_caller.item_in_inventory.is_in_group("fire"):

animation_player.play("Activated")
self.lit = true

emit_signal("on")

#black_board["activated_pillars"] += 1
#if black_board["activated_pillars"] == 1:
# print("test1")

return true
if interaction_caller.item_in_inventory.on == true:
#animation_player.play("Activated")
self.lit = true
emit_signal("on")
return true
elif self.lit:
interaction_caller.item_in_inventory.on = true
return true

return false


Expand Down
15 changes: 11 additions & 4 deletions first-person-ascii-art-demo/Interactables/Torch.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
extends Spatial

export var on = false
export var on = false setget set_on

onready var torchlight = $TorchLight
var state = 0


Expand All @@ -23,15 +24,21 @@ func _on_Interactable_interacted(interaction_string,interaction_caller):
if interaction_string == "drop":
interaction_caller.de_equip_item(self)
if interaction_string == "use" or state == 1:
if on and 0 == 1:
if not on:
$TorchLight.hide()
else:
$TorchLight.show()
on = !on
state = 2




func set_on(val):
if torchlight:
if val:
$TorchLight.show()
else:
$TorchLight.hide()
on = val

func _on_RandomTimer_timeout():
pass # Replace with function body.
8 changes: 7 additions & 1 deletion first-person-ascii-art-demo/Interactables/TorchHolder.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ func _ready():


func _on_Interactable_interacted(interaction_string, interaction_caller):
pass # Replace with function body.
if (interaction_string == "light" or 1 == 1) and \
not interaction_caller.item_in_inventory == null and \
interaction_caller.item_in_inventory.is_in_group("fire"):


interaction_caller.item_in_inventory.on = true
return true
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3.95446, -0.329587, 0 )

[node name="FirePedestal2" parent="." instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.84193, -0.329587, 0 )
lit = true

[node name="Torch" parent="." instance=ExtResource( 3 )]
transform = Transform( -3.21965e-08, -0.736569, 0.676362, 1, -4.37114e-08, 0, 2.95647e-08, 0.676362, 0.736569, -4.46896, 0.087595, -5.95753 )
Expand Down
16 changes: 8 additions & 8 deletions first-person-ascii-art-demo/RoomScenes/GameWorld.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 4.09782e-08, 1, 2.5, 3 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"times": PoolRealArray( 1, 2.5, 3 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Vector3( 155.065, 0.18312, 61.9813 ), Vector3( 152.27, -2.17126, 61.0024 ), Vector3( 150.12, -2.18153, 57.8075 ), Vector3( 148.025, -3.21886, 57.8075 ) ]
"values": [ Vector3( 152.27, -2.17126, 61.0024 ), Vector3( 150.12, -2.18153, 57.8075 ), Vector3( 148.025, -3.21886, 57.8075 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Player:rotation_degrees")
Expand All @@ -177,10 +177,10 @@ tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 1, 2.5 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"times": PoolRealArray( 1, 2.5 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector3( 10, -90, 0 ), Vector3( 0, 90, 0 ), Vector3( -30, 90, 0 ) ]
"values": [ Vector3( 0, 90, 0 ), Vector3( -30, 90, 0 ) ]
}

[sub_resource type="BoxShape" id=5]
Expand All @@ -190,7 +190,7 @@ extents = Vector3( 1.32968, 1, 1 )
script = ExtResource( 7 )

[node name="Player" parent="." instance=ExtResource( 1 )]
transform = Transform( -1.62921e-07, -0.173648, -0.984807, 0, 0.984808, -0.173648, 1, -2.82909e-08, -1.60445e-07, 155.065, 0.18312, 61.9813 )
transform = Transform( -1, 0, -8.74227e-08, 0, 1, 0, 8.74228e-08, 0, -0.999999, -0.737334, 0, -6.25559 )

[node name="SpotLight" type="SpotLight" parent="."]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 10, 0 )
Expand Down Expand Up @@ -218,7 +218,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3.98091, 0, 2.42827 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.54793, -8.10181 )

[node name="LightMaze" parent="." instance=ExtResource( 5 )]
transform = Transform( -0.999983, 0, -0.00584672, 0, 1, 0, 0.00584672, 0, -0.999983, -5.81547, -2.426, 83.6999 )
transform = Transform( -0.999983, 0, -0.00584672, 0, 1, 0, 0.00584672, 0, -0.999983, -5.81547, -2.426, 83.244 )

[node name="WorldItems" type="Spatial" parent="."]

Expand Down