| MAIN | NEWS | FAQS | LINKS | ARTICLES | WORKSHOP |
Send Mail To:Steve Register
AOR Work In Progress: Entry 2 - Monsters [Steve Register].
	Now its time to place monster on the map. Once again I start by using
Thomas' code with some changes to the structures so that it will work
the way I want it to work. The monsters are now in the dungeon and drawn
on the map.

	That's as far as Qhack goes. It creates a character, creates the
dungeon, creates the monster map, displays it all on the screen with a
few commands enabled. It doesn't recognize that the monster are there.
Now I'm on my own.

	First I decided to see if I could get to recognize that a monster was
at a particular tile. This was easy enough Thomas had a function that
would tell if a monster was at a particular x, y coordinate. I placed
this in the code that checked if the cell that the player was going into
was empty.

	Now I knew if a monster occupied the cell that the PC was moving into.
Now I wanted to find out which particular monster occupied that cell so
that I could start getting ready for some combat code. I thought I had
it figured out. I added code that when the PC would occupy a cell that
contained a monster it would print the index number and the name of the
monster. At first it seemed to work. I noticed that when the screen
scrolled it still could tell that a monster was in a cell but it would
print the wrong index and name. I also noticed that when the map
scrolled if the monster did not get scrolled of the screen it did not
get redrawn. When you moved into the cell where the monster was it still
said that a monster was there.

	Thomas was using an indexed list thing to keep track of the monsters
and such. I really don't understand what was being done so I have
decided to go another route.

What I plan to do is use a layered array to keep track of all of the
objects. The bottom layer will be the dungeon itself. The middle layer
will be the objects layer, potions, weapons, etc. etc. The top layer
will be the monsters. This way I should be able to just draw all three
layers and the map will be correct.

	Well that's where I'm at, at this point. I haven't work on the program
since Darren asked me if I would write this article. Now that I finished
this first part I will start to work on it again and keep you informed
of the problems and solutions or work-around that I come up with. I plan
to update this at least weekly, but may be update anywhere from daily to
weekly depending on how much time I get to work on the program. I do
have a web page set up. From there you will be able to download the
source codes and executables. There is not much there now just an
announcement that I am working the game. For those that want to see it
go to  http://members.theglobe.com/saregist/

	As soon as I get enough done I'll set the page up for downloading and
there will be an announcement on the Roguelike News Page.

Back to Entry 1 - The Map.
On to Entry 3 - Map Arrays.

© Copyright 2001 Steve Register.