diff --git a/OldComputer.tscn b/OldComputer.tscn new file mode 100644 index 0000000..e8d6cbe --- /dev/null +++ b/OldComputer.tscn @@ -0,0 +1,49 @@ +[gd_scene format=3 uid="uid://bcu7ftukipiyy"] + +[ext_resource type="Script" uid="uid://d0lvnnd3mqfxh" path="res://old_computer.gd" id="1_6jyhx"] +[ext_resource type="Texture2D" uid="uid://brppyauh1xyif" path="res://art/computer/background.png" id="2_2wyuv"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2wyuv"] +bg_color = Color(0.28627452, 0.25490198, 0.22745098, 1) + +[node name="OldComputer" type="CanvasLayer" unique_id=1944134941] +script = ExtResource("1_6jyhx") + +[node name="BackgroundPanel" type="Panel" parent="." unique_id=1876350245] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="ForegroundPanel" type="Panel" parent="BackgroundPanel" unique_id=1797726425] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_2wyuv") + +[node name="ScreenPanel" type="Panel" parent="BackgroundPanel/ForegroundPanel" unique_id=528166777] +layout_mode = 0 +offset_left = 82.0 +offset_top = 42.0 +offset_right = 122.81183 +offset_bottom = 85.64739 +scale = Vector2(27.099607, 14.530945) + +[node name="Sprite2D" type="Sprite2D" parent="BackgroundPanel" unique_id=856709145] +position = Vector2(618, 349) +texture = ExtResource("2_2wyuv") + +[node name="ConsoleText" type="RichTextLabel" parent="." unique_id=715961645] +offset_left = 150.0 +offset_top = 105.0 +offset_right = 1102.0 +offset_bottom = 652.0 +text = ">> Pharaoh OS 2000 Boot Sequence +>> WARN: Detected anomalies! +>> WARN: Memory integrity at %d%%! +>> User: Please load backup data disk (1 of 4) +>> Player: Press interact [E] or jump [Space] to exit." diff --git a/art/computer/background.png b/art/computer/background.png new file mode 100644 index 0000000..c37bbeb Binary files /dev/null and b/art/computer/background.png differ diff --git a/art/computer/background.png.import b/art/computer/background.png.import new file mode 100644 index 0000000..55bf621 --- /dev/null +++ b/art/computer/background.png.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://brppyauh1xyif" +path="res://.godot/imported/background.png-26b98ec3cc5bed410faa484fde97db25.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/computer/background.png" +dest_files=["res://.godot/imported/background.png-26b98ec3cc5bed410faa484fde97db25.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/high_quality_mode=0 +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +mipmaps/preserve_alpha_test_coverage=false +mipmaps/alpha_test_threshold=0.5 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/old_computer.gd b/old_computer.gd new file mode 100644 index 0000000..1bb19de --- /dev/null +++ b/old_computer.gd @@ -0,0 +1,15 @@ +extends CanvasLayer + +func _ready() -> void: + $ConsoleText.text = $ConsoleText.text % %Pharaoh.get_memory_integrity() + open() + +func open() -> void: + visible = true + +func printline(line: String) -> void: + open() + $ConsoleText.text += "\n" + line + +func close() -> void: + visible = false diff --git a/old_computer.gd.uid b/old_computer.gd.uid new file mode 100644 index 0000000..a7bd0cc --- /dev/null +++ b/old_computer.gd.uid @@ -0,0 +1 @@ +uid://d0lvnnd3mqfxh diff --git a/pharaoh.gd b/pharaoh.gd index 28be541..274967a 100644 --- a/pharaoh.gd +++ b/pharaoh.gd @@ -3,8 +3,8 @@ extends Interactable var disks_wanted = [1, 2, 3, 4] var disks_loaded = [] -func _ready() -> void: - pass # Replace with function body. +var starting_integrity = 2 +var total_integrity = starting_integrity + len(disks_wanted) func load_disk(disk_num: int) -> bool: if !disk_num or (disk_num in disks_loaded): @@ -14,6 +14,9 @@ func load_disk(disk_num: int) -> bool: disks_wanted.remove_at(disks_wanted.find(disk_num)) return true +func get_memory_integrity(): + return 100.0 / total_integrity * (starting_integrity + len(disks_loaded)) + func _on_interacted() -> void: var wanted_disk = disks_wanted.front() if not %Player2D.take_disk(wanted_disk): @@ -24,9 +27,13 @@ func _on_interacted() -> void: %Player2D.complete_objective("disk%d" % wanted_disk) print("Loaded up disk ", wanted_disk) + %OldComputer.printline( + ">> Loaded data disk %d (of %d). Memory integrity now at %d%%" % + [wanted_disk, len(disks_wanted) + len(disks_loaded), get_memory_integrity()] + ) wanted_disk = disks_wanted.front() - if wanted_disk and %Player2D.has_disk(wanted_disk): + if (not wanted_disk) or %Player2D.has_disk(wanted_disk): return %Player2D.give_objective("disk%d" % wanted_disk, "Locate data disk %d" % wanted_disk) diff --git a/player_2d.gd b/player_2d.gd index e1a969a..a58f406 100644 --- a/player_2d.gd +++ b/player_2d.gd @@ -99,7 +99,12 @@ func _process(delta: float) -> void: if Input.is_action_just_released("restart") or (Input.is_action_pressed("controller_restart_left") and Input.is_action_pressed("controller_restart_right")): get_tree().reload_current_scene() + if Input.is_action_just_released("interact"): + %OldComputer.close() + if Input.is_action_just_pressed("jump"): + %OldComputer.close() + if is_on_floor(): velocity.y = JUMP_VELOCITY elif !is_on_floor() and jumps >= 1: @@ -114,7 +119,10 @@ func _process(delta: float) -> void: print("WALL HANGING") #velocity.y = 0 #velocity.x = 0 - + + if %OldComputer.visible: + return + var direction = Input.get_axis("move_left","move_right") if direction < 0: diff --git a/world.tscn b/world.tscn index c8cf268..5e10cf6 100644 --- a/world.tscn +++ b/world.tscn @@ -18,6 +18,7 @@ [ext_resource type="Script" uid="uid://d3rx82psovcpp" path="res://music_button.gd" id="14_70uel"] [ext_resource type="Script" uid="uid://oyyhhy1gemg0" path="res://objectives_label.gd" id="14_ikiii"] [ext_resource type="PackedScene" uid="uid://dr8h8xij3qw2h" path="res://pharaoh.tscn" id="15_hiqwa"] +[ext_resource type="PackedScene" uid="uid://bcu7ftukipiyy" path="res://OldComputer.tscn" id="19_cbp6q"] [node name="World" type="Node2D" unique_id=1327991900] process_mode = 1 @@ -359,4 +360,7 @@ script = ExtResource("14_70uel") unique_name_in_owner = true position = Vector2(192, 185.11545) +[node name="OldComputer" parent="." unique_id=1951254108 instance=ExtResource("19_cbp6q")] +unique_name_in_owner = true + [connection signal="toggled" from="CanvasLayer/MusicButton" to="CanvasLayer/MusicButton" method="_on_toggled"]