Skip to content

Commit

Permalink
First
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolejorn committed Aug 18, 2024
0 parents commit 4488d6c
Show file tree
Hide file tree
Showing 47 changed files with 2,158 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Godot 4+ specific ignores
.godot/
Binary file not shown.
Binary file added .vs/DungeonHoldings/v17/.wsuo
Binary file not shown.
41 changes: 41 additions & 0 deletions .vs/DungeonHoldings/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\sadie\\OneDrive\\Documents\\DungeonHoldings\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\sadie\\OneDrive\\Documents\\DungeonHoldings\\FloorSelect.tscn||{8B382828-6202-11D1-8870-0000F87579D2}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:FloorSelect.tscn||{8B382828-6202-11D1-8870-0000F87579D2}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "FloorSelect.tscn",
"DocumentMoniker": "C:\\Users\\sadie\\OneDrive\\Documents\\DungeonHoldings\\FloorSelect.tscn",
"RelativeDocumentMoniker": "FloorSelect.tscn",
"ToolTip": "C:\\Users\\sadie\\OneDrive\\Documents\\DungeonHoldings\\FloorSelect.tscn",
"RelativeToolTip": "FloorSelect.tscn",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAYAAAATAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
"WhenOpened": "2024-08-16T21:42:12.482Z",
"EditorCaption": ""
}
]
}
]
}
]
}
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
7 changes: 7 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ExpandedNodes": [
""
],
"SelectedNode": "\\FloorSelect.tscn",
"PreviewInSolutionExplorer": false
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
3 changes: 3 additions & 0 deletions CurrentFloor.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[gd_scene format=3 uid="uid://dg3quib5dwe5b"]

[node name="CurrentFloor" type="Node2D"]
98 changes: 98 additions & 0 deletions Floor.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
extends Node2D
var intro = "(Row)(Column)(Letter) Options:
- Chest (c): Motivate your victims.
- Key (k) Give heroes a hope spot.
- Puzzle (p#) Make the hero give up. Higher # = more effective.
- Boss (b) Place it wisely! You only get one.
- Enemies (e#) Put # of enemies in a room."
# Set a starter value for each position
#var floorGrid = []

func createNewRooms():
Global.score = 0
Global.puzzleChallenge = 0
Global.floorGrid = []
for i in Global.floor_width:
Global.floorGrid.append([])
for j in Global.floor_height:
Global.floorGrid[i].append('x')
$FloorMap.text = Global.currentGoldString + "
x12345
1" + str(Global.floorGrid[0]) + "\n2" + str(Global.floorGrid[1]) + "\n3" + str(Global.floorGrid[2]) + "\n4" + str(Global.floorGrid[3]) + "\n5" + str(Global.floorGrid[4])
$Updates.text = intro

# Called when the node enters the scene tree for the first time.
func _ready():
createNewRooms()
#Maybe a way to put multiple objects in a room


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
Global.currentGoldString = "Current Gold: " + str(Global.currentGold) + "\n"
$FloorMap.text = Global.currentGoldString + "
x12345
1" + str(Global.floorGrid[0]) + "\n2" + str(Global.floorGrid[1]) + "\n3" + str(Global.floorGrid[2]) + "\n4" + str(Global.floorGrid[3]) + "\n5" + str(Global.floorGrid[4])


func _on_line_edit_text_submitted(new_text):
var row
var column
if(new_text.substr(0,1).is_valid_int()):
row = (int(new_text.substr(0,1)) -1)
if(new_text.substr(1,1).is_valid_int()):
column = (int(new_text.substr(1,1)) -1)
if(new_text.substr(2,1).to_lower() == 'c'):
if Global.currentGold < 200:
$Updates.text = intro + "You don't have enough gold!"
else:
Global.floorGrid[int(row)][int(column)] = 'c'
Global.currentGold -= 200
Global.heroes[Global.floorCount - 3][1] += 10
if Global.heroes[Global.floorCount - 3][0] > 0:
Global.heroes[Global.floorCount - 3][0] -= 5
if(new_text.substr(2,1).to_lower() == 'k'):
if Global.currentGold < 200:
$Updates.text = intro + "You don't have enough gold!"
else:
Global.floorGrid[int(row)][int(column)] = 'k'
Global.currentGold -= 200
if Global.heroes[Global.floorCount - 3][0] > 0:
Global.heroes[Global.floorCount - 3][0] -= 2
if(new_text.substr(2,1).to_lower() == 'e'):
if(new_text.substr(3,1).is_valid_int()):
if Global.currentGold < (100 * int(new_text.substr(3,1))):
$Updates.text = intro + "You don't have enough gold!"
else:
Global.floorGrid[int(row)][int(column)] = new_text.substr(3,1)
Global.score += (10 * int(new_text.substr(3,1)))
Global.currentGold -= (100 * int(new_text.substr(3,1)))
if(new_text.substr(2,1).to_lower() == 'p'):
if(new_text.substr(3,1).is_valid_int()):
if Global.currentGold < (200 * int(new_text.substr(3,1))):
$Updates.text = intro + "You don't have enough gold!"
else:
Global.floorGrid[int(row)][int(column)] = new_text.substr(3,1)
Global.puzzleChallenge += int(new_text.substr(3,1))
Global.currentGold -= (200 * int(new_text.substr(3,1)))
if(new_text.substr(2,1).to_lower() == 'b') and (not Global.bossPlaced):
if Global.currentGold < 500:
$Updates.text = intro + "You don't have enough gold!"
else:
Global.floorGrid[int(row)][int(column)] = 'b'
Global.score += 50
Global.bossPlaced = true
Global.currentGold -= 500
#$Updates.text = intro + ""


func _on_done_pressed():
Global.floorArray[Global.currentFloor - 1] = Global.floorGrid
Global.floorArray[Global.currentFloor - 1].append(Global.score)
Global.floorArray[Global.currentFloor - 1].append(Global.puzzleChallenge)
if(Global.currentFloor != Global.floorCount):
Global.currentFloor += 1
createNewRooms()
else:
#print(Global.floorArray)
get_tree().change_scene_to_file("res://Results.tscn")
43 changes: 43 additions & 0 deletions Floor.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[gd_scene load_steps=4 format=3 uid="uid://dc5ry8exkxrsm"]

[ext_resource type="Script" path="res://Floor.gd" id="1_mtghe"]
[ext_resource type="Texture2D" uid="uid://duxa55rik8k5" path="res://green.png" id="2_diflm"]

[sub_resource type="SystemFont" id="SystemFont_1c4x5"]

[node name="Floor" type="Node2D"]
script = ExtResource("1_mtghe")

[node name="TextureRect" type="TextureRect" parent="."]
offset_right = 1150.0
offset_bottom = 640.0
texture = ExtResource("2_diflm")
expand_mode = 1

[node name="LineEdit" type="LineEdit" parent="."]
offset_right = 400.0
offset_bottom = 200.0

[node name="Updates" type="RichTextLabel" parent="."]
offset_left = 100.0
offset_top = 300.0
offset_right = 500.0
offset_bottom = 600.0

[node name="FloorMap" type="Label" parent="."]
offset_left = 900.0
offset_top = 100.0
offset_right = 1100.0
offset_bottom = 300.0
theme_override_fonts/font = SubResource("SystemFont_1c4x5")
theme_override_font_sizes/font_size = 18

[node name="Done" type="Button" parent="."]
offset_left = 200.0
offset_top = 550.0
offset_right = 254.0
offset_bottom = 581.0
text = "DONE"

[connection signal="text_submitted" from="LineEdit" to="." method="_on_line_edit_text_submitted"]
[connection signal="pressed" from="Done" to="." method="_on_done_pressed"]
26 changes: 26 additions & 0 deletions FloorSelect.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
extends Control

#var floorCount = get_tree().get_node("Settings").get("floorCount")

func _unhandled_input(event: InputEvent) -> void:
if event is InputEventKey and event.is_pressed() and not event.is_echo():
var typed_event = event as InputEventKey
var key_typed = PackedByteArray([typed_event.unicode]).get_string_from_utf8()
if key_typed.is_valid_int():
if (int(key_typed)) > 0 and (int(key_typed)) <= Global.floorCount:
Global.currentFloor = int(key_typed)
$Label.text = "Floor: " + str(Global.currentFloor) + "/" + str(Global.floorCount)
elif key_typed == 'p':
$Label.visible = false
#finalizedFloors.emit(floorCount)
get_tree().change_scene_to_file("res://Floor.tscn")

# Called when the node enters the scene tree for the first time.
func _ready():
$Label.visible = true
$Label.text = "Floor: " + "1"+ "/" + str(Global.floorCount)


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
17 changes: 17 additions & 0 deletions FloorSelect.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[gd_scene load_steps=2 format=3 uid="uid://c6oux5c52ua5k"]

[ext_resource type="Script" path="res://FloorSelect.gd" id="1_45qyd"]

[node name="FloorSelect" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_45qyd")

[node name="Label" type="Label" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 23.0
41 changes: 41 additions & 0 deletions Results.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
extends Node2D

func playFloor(thisFloor):
var rng = RandomNumberGenerator.new()
Global.score = thisFloor[-2]
#print(Global.score)
Global.heroHealth -= (Global.score - Global.heroes[Global.floorCount - 3][0])
#print(Global.heroHealth)
Global.puzzleChallenge = thisFloor[-1]
#print(Global.puzzleChallenge + Global.heroes[Global.floorCount - 3][1])
Global.heroGaveUp = randi_range(1, 100) < (Global.puzzleChallenge + Global.heroes[Global.floorCount - 3][1])
#print(Global.puzzleChallenge)

# Called when the node enters the scene tree for the first time.
func _ready():
$FinalResult.visible = false
for i in Global.floorArray:
#could be a two-player game instead of ai
playFloor(i)
if Global.heroHealth < 1 or Global.heroGaveUp == true:
$FinalResult.visible = true
$FinalResult.text = "You win!"
#give gold based on difficulty
break
if Global.heroHealth > 0 and Global.heroGaveUp == false:
$FinalResult.visible = true
$FinalResult.text = "You lose!"


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass


func _on_play_again_pressed():
Global.bossPlaced = false
Global.floorCount = 3
#Global.currentGold = 6000
Global.cost = 0
Global.currentFloor = 1
get_tree().change_scene_to_file("res://Settings.tscn")
18 changes: 18 additions & 0 deletions Results.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[gd_scene load_steps=2 format=3 uid="uid://bjjgjd5y2rijn"]

[ext_resource type="Script" path="res://Results.gd" id="1_od1fr"]

[node name="Results" type="Node2D"]
script = ExtResource("1_od1fr")

[node name="FinalResult" type="Label" parent="."]
offset_right = 40.0
offset_bottom = 23.0

[node name="PlayAgain" type="Button" parent="."]
offset_top = 200.0
offset_right = 87.0
offset_bottom = 231.0
text = "Play again"

[connection signal="pressed" from="PlayAgain" to="." method="_on_play_again_pressed"]
45 changes: 45 additions & 0 deletions Settings.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
extends Control

#signal finalizedFloors(count)

func _unhandled_input(event: InputEvent) -> void:
if event is InputEventKey and event.is_pressed() and not event.is_echo():
var typed_event = event as InputEventKey
var key_typed = PackedByteArray([typed_event.unicode]).get_string_from_utf8()
if key_typed.is_valid_int():
if (int(key_typed)) > 2 and (int(key_typed)) < 6: #might make range smaller
Global.floorCount = int(key_typed)
Global.cost = Global.floorCount * 300
$Label.text = Global.currentGoldString + "Floor count: " + str(Global.floorCount) + " Cost: " + str(Global.cost)
elif key_typed == 'p' and Global.currentGold >= Global.cost:
#m = Mode.FLOOR_SELECT
Global.currentGold -= Global.cost
$Label.visible = false
Global.floorArray.resize(Global.floorCount)
Global.floorArray.fill(false)
#finalizedFloors.emit(floorCount)
Global.currentFloor = 1
get_tree().change_scene_to_file("res://Floor.tscn")
#get_tree().change_scene_to_file("res://FloorSelect.tscn")

func generateHero(strength):
Global.heroes[strength].append(strength * 5)
Global.heroes[strength].append(strength * 20)
Global.heroes[strength].append(strength)
#The % chance they give up = 100 - (persistence + difficulty)

# Called when the node enters the scene tree for the first time.
func _ready():
Global.heroes = [] #might be better as 1d array
for i in 3:
Global.heroes.append([])
generateHero(i)
print(Global.heroes)
$Label.visible = true
Global.cost = Global.floorCount * 300
$Label.text = Global.currentGoldString + "Floor count: " + str(Global.floorCount) + " Cost: " + str(Global.cost)


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
$PlayerStats.text = str(Global.heroes[Global.floorCount - 3])
25 changes: 25 additions & 0 deletions Settings.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[gd_scene load_steps=2 format=3 uid="uid://hj8ey68yb2tg"]

[ext_resource type="Script" path="res://Settings.gd" id="1_1btmc"]

[node name="Settings" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_1btmc")

[node name="Label" type="Label" parent="."]
layout_mode = 0
offset_left = 50.0
offset_right = 90.0
offset_bottom = 23.0

[node name="PlayerStats" type="Label" parent="."]
layout_mode = 0
offset_left = 50.0
offset_top = 100.0
offset_right = 90.0
offset_bottom = 123.0
Loading

0 comments on commit 4488d6c

Please sign in to comment.