❔ ✅ Text Based Game Assignment
my best gues from my limited coding knowledge would be to use a 3d array
22 Replies
that somehow clears the console every time the object is moved
and prints the updatated version of the "map"
if you would like to see all the code let me know
i want the map to be represented in a text form
You can use a 2d array of chars
Designate a specific char to represent an obstacle (or use multiple chars for obstacles if you want)
You can also manually set the cursor position (look at System.Console.SetCursorPosition) which would let you just re-print each space over what it was before
so im not sure what i need cursor position for as its all text based. even the options you have to write with your keybard
would you mind exlpaining
Cursor position is not the mouse position
oh okay let me do some quick googling then
so ive started with
I would use a space for empty tiles
right yea ive changed that
but my biggest issue is how do i make "C" move
idk how to make it move around the array
Store its X and y position separately from the array
When you would change the position, clear the tile at its current position before changing the position, then update the position and put c at the new coordinates
i attempted to print the array as a map

but it just doesnt look very user friendly
You can always use special characters
https://en.m.wikipedia.org/wiki/Box-drawing_character
Box-drawing character
Box-drawing characters, also known as line-drawing characters, are a form of semigraphics widely used in text user interfaces to draw various geometric frames and boxes. These characters are characterised by being designed to be connected horizontally and/or vertically with adjacent characters, which requires proper alignment. Box-drawing charac...
There is also a character that looks like a filled rectangle but I can't remember where it was
right thank you
got those
do you know any articles that cover the use of coordinates
within a 2d array
and how to move an object within one
I don't know any articles but the concept should be relatively simple
The objects need to be associated with a coordinate position that determines where they should be placed in the array
The array should not determine their position
okay
ill do some googling thank you for the help
@shuffle this sounds similar to "wumpus world". I have an example of wumpus world on GitHub. would you like me to link it?
yes please
https://github.com/dotnet/dotnet-console-games/tree/main/Projects/Wumpus%20World
It's not exactly the same but in wumpus world (at least this version) it is a 4x4 grid where you try to find the gold while avoiding pits and a wumpus
my only concern is
my proramming knowledge isnt advanced enough to undesrtand him using a lot of these things
for example or
Have you ever written code before?
yes but not much
i stated that at the start
i can show u the code to my program if youd like
!close
Closed!
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.