Compare commits

...

8 Commits

Author SHA1 Message Date
83ba1fb7fa remove unused file 2020-09-01 21:11:58 -07:00
14f115649e move items to proper items file 2020-08-31 21:47:51 -07:00
285c4e5fdc move other items to items file 2020-08-31 21:47:35 -07:00
ad58ddf721 move function to top 2020-08-31 21:46:55 -07:00
17595a2750 ignore binary 2020-08-31 21:43:25 -07:00
89f599e710 move title proc to romms file 2020-06-03 02:14:39 -07:00
cfd7d244ca Separate files, add backpack collection proc 2020-06-03 02:08:28 -07:00
8a085910fb revert dash to underscore 2020-05-26 18:28:33 -07:00
7 changed files with 121 additions and 53 deletions

2
.gitignore vendored
View File

@@ -2,4 +2,4 @@
nimcache/
nimblecache/
htmldocs/
geedren-mansion
geedren_mansion

View File

@@ -6,7 +6,7 @@ description = "Mystery game in haunted mansion"
license = "MIT"
srcDir = "src"
installExt = @["nim"]
bin = @["geedren-mansion"]
bin = @["geedren_mansion"]

View File

@@ -1,67 +1,29 @@
# This is just an example to get you started. A typical hybrid package
# uses this file as the main entry point of the application.
import geedren_mansionpkg/objects
import strformat
import
# package imports
geedren_mansionpkg/objects,
geedren_mansionpkg/rooms,
geedren_mansionpkg/items,
geedren_mansionpkg/characters,
# Language imports
strformat
when isMainModule:
var phone = Item(
name: "Phone",
description: "Communication device/ pocket computer"
)
var player = Character(
name: "Sam",
backpack: @[phone]
)
title_screen()
# Room 1 of mansion
proc foyer_room() =
var foyer = Room(
name: "Foyer",
description: "Entrance Hall of the Geedren Mansion",
text: """
zdsfgzdfg
""",
secrets: 2
)
var desk = Item(
name: "Desk",
description: "A small wooden desk",
contents: "key"
)
echo foyer.text
proc title_screen() =
echo fmt"""
Welcome to Geedren Mansion. You are {player.name}, a capable 24 year old adventurer.
Your uncle Rob has been missing for 10 years. He went hunting for the secrets and treasure rumored to
be hidden deep within the walls of the mysterious Geedren Mansion. Now that you are of age and have
trained in adventuring, you have decided to find your uncle. Your mission is dangerous as many men
have gone missing with the mansion being their last known whereabouts. The door is unlocked and you
walk right in the doors of the massive mansion.
"""
stdout.write("Press 1 to contnue: ")
var choice = stdin.readLine()
if choice == "1":
foyer_room(foyer)
else:
echo "You pressed the wrong key!"
title_screen()

View File

@@ -0,0 +1,18 @@
import
objects,
items
var curDirect*: Direct
curDirect = up
var
player* = Character(
name: "Sam",
backpack: @[phone],
placesVisited: @[],
currentDirection: curDirect
)

View File

@@ -0,0 +1,28 @@
import
objects
var
phone* = Item(
name: "Phone",
description: "Communication device"
)
foyer* = Room(
name: "Foyer",
description: "Entrance Hall of the Geedren Mansion",
text: "",
secrets: 2
)
cathDoorKey* = Item(
name: "Cathedral Door Key",
description: "This key opens the door to the cathedral"
)
desk* = Container(
name: "Desk",
description: "A small wooden desk",
contents: @[cathDoorKey]
)

View File

@@ -1,22 +1,41 @@
type
Direct* = enum
up, down, left, right
Item* = object
name*: string
description*: string
contents*: string
Character* = object
name*: string
backpack*: seq[Item]
placesVisited*: seq[string]
currentDirection*: Direct
Secret* = object
name*: string
description*: string
found*: bool
Dialog* = object
text*: string
priority*: int
kind*: string
Room* = object
name*: string
description*: string
text*: string
secrets*: int
Container* = object
name*: string
description*: string
contents*: seq[Item]

View File

@@ -0,0 +1,41 @@
import
objects,
characters,
items,
procs,
strformat
proc foyer_room*(player: Character) =
var
player = player
#[
player.placesVisited.add(foyer.name)
player.backpack.add(desk.contents)
for backpack in player.backpack:
echo(fmt"{backpack.name}: {backpack.description}")
]#
discard addToBackpack(player, desk)
proc title_screen*() =
echo fmt"""
Welcome to Geedren Mansion. You are {player.name}, a capable 24 year old adventurer.
Your uncle Rob has been missing for 10 years. He went hunting for the secrets and treasure rumored to
be hidden deep within the walls of the mysterious Geedren Mansion. Now that you are of age and have
trained in adventuring, you have decided to find your uncle. Your mission is dangerous as many men
have gone missing with the mansion being their last known whereabouts. The door is unlocked and you
walk right in the doors of the massive mansion.
"""
stdout.write("Press 1 to contnue: ")
var choice = stdin.readLine()
if choice == "1":
foyer_room(player)
else:
echo "You pressed the wrong key!"