Click here to Skip to main content
15,902,636 members
Home / Discussions / C#
   

C#

 
AnswerRe: Storing values into a 2-Dimensional Array Pin
Pete O'Hanlon15-Jul-08 9:57
mvePete O'Hanlon15-Jul-08 9:57 
GeneralRe: Storing values into a 2-Dimensional Array Pin
Reality Strikes15-Jul-08 11:16
Reality Strikes15-Jul-08 11:16 
QuestionIcon resources from name Pin
Echilon15-Jul-08 4:37
Echilon15-Jul-08 4:37 
AnswerRe: Icon resources from name Pin
leppie15-Jul-08 4:56
leppie15-Jul-08 4:56 
QuestionProblem with custom installer class Pin
topcatalpha15-Jul-08 4:22
topcatalpha15-Jul-08 4:22 
Questionc# and flash Query Pin
Jayawant Karale15-Jul-08 3:06
Jayawant Karale15-Jul-08 3:06 
QuestionRougelike project Map Cell history, Suggestions? Pin
Jason Farrar15-Jul-08 3:01
Jason Farrar15-Jul-08 3:01 
AnswerRe: Rougelike project Map Cell history, Suggestions? Pin
Simon P Stevens15-Jul-08 3:43
Simon P Stevens15-Jul-08 3:43 
Disconnect the map abstraction from your specific implementation of the characters being drawn.

Have a map cell class that holds an enum for the floor type. Have an item class that stores the items location (or hold it in an item property on the mapcell class). and a player class that stores the players location.

When you draw the map, decide on the character to draw at the last moment. Iterate through the grid, check if the player is on the cell, (if so draw the player), then check if there is an item there (if so, draw the item), then if neither of the first checks resulted in anything being drawn, check the cell type and draw the cell. Don't ever then rely on looking at what's been drawn to decide on the current state. Use the state of the objects to decide what to do. When something changes, change the objects and call a method to simply redraw the affected cells, this will then be easy to redraw as you just look at your object state again for each cell being drawn.

(Finally, don't worry about performance until it starts to cause problems. You're writing a ascii drawn game, you really aren't going to hit any performance problems drawing a 500x500 grid of ascii characaters on any semi modern PC.)

Simon

GeneralRe: Rougelike project Map Cell history, Suggestions? Pin
Jason Farrar15-Jul-08 6:14
Jason Farrar15-Jul-08 6:14 
Questionresize proportionally for listbox Pin
emailthiaga15-Jul-08 2:58
emailthiaga15-Jul-08 2:58 
AnswerRe: resize proportionally for listbox Pin
John Ad15-Jul-08 3:16
John Ad15-Jul-08 3:16 
GeneralRe: resize proportionally for listbox Pin
emailthiaga15-Jul-08 4:02
emailthiaga15-Jul-08 4:02 
Questionhttp://company.zhaopin.com/P2/CC1536/6331/CC153663319.htm?DYWE=1213680294625.66308.1216003477.1216121212.8 [modified] Pin
chenli051315-Jul-08 1:33
chenli051315-Jul-08 1:33 
GeneralRe: http://company.zhaopin.com/P2/CC1536/6331/CC153663319.htm?DYWE=1213680294625.66308.1216003477.1216121212.8 Pin
Simon P Stevens15-Jul-08 1:52
Simon P Stevens15-Jul-08 1:52 
GeneralSubject line too long and scary... Pin
Paul Conrad16-Jul-08 4:48
professionalPaul Conrad16-Jul-08 4:48 
QuestionAND and OR with expressions Pin
enginço15-Jul-08 1:28
enginço15-Jul-08 1:28 
QuestionRe: AND and OR with expressions Pin
CPallini15-Jul-08 2:36
mveCPallini15-Jul-08 2:36 
AnswerRe: AND and OR with expressions Pin
enginço15-Jul-08 4:19
enginço15-Jul-08 4:19 
QuestionC# Datagridview Pin
Member 364449715-Jul-08 0:57
Member 364449715-Jul-08 0:57 
AnswerRe: C# Datagridview Pin
benjymous15-Jul-08 1:08
benjymous15-Jul-08 1:08 
Questionto get record count of SQL Query...? Pin
Raheem MA15-Jul-08 0:52
Raheem MA15-Jul-08 0:52 
AnswerRe: to get record count of SQL Query...? Pin
mark_w_15-Jul-08 0:57
mark_w_15-Jul-08 0:57 
AnswerRe: to get record count of SQL Query...? Pin
Nirandas15-Jul-08 1:22
Nirandas15-Jul-08 1:22 
GeneralRe: to get record count of SQL Query...? Pin
Raheem MA15-Jul-08 1:58
Raheem MA15-Jul-08 1:58 
AnswerRe: to get record count of SQL Query...? Pin
Wendelius15-Jul-08 6:45
mentorWendelius15-Jul-08 6:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.