Click here to Skip to main content
15,867,568 members
Home / Discussions / C#
   

C#

 
QuestionRegular Expressions [modified] Pin
Mikey_H9-Aug-09 17:29
Mikey_H9-Aug-09 17:29 
AnswerRe: Regular Expressions Pin
PIEBALDconsult9-Aug-09 21:33
mvePIEBALDconsult9-Aug-09 21:33 
GeneralRe: Regular Expressions Pin
Mikey_H10-Aug-09 9:30
Mikey_H10-Aug-09 9:30 
GeneralRe: Regular Expressions Pin
PIEBALDconsult10-Aug-09 9:53
mvePIEBALDconsult10-Aug-09 9:53 
QuestionUnable to send image on UDP larger than 10K Pin
atifmuzaffar9-Aug-09 15:55
atifmuzaffar9-Aug-09 15:55 
AnswerThis may sound silly but Pin
Ennis Ray Lynch, Jr.9-Aug-09 18:23
Ennis Ray Lynch, Jr.9-Aug-09 18:23 
AnswerRe: Unable to send image on UDP larger than 10K Pin
Luc Pattyn9-Aug-09 22:59
sitebuilderLuc Pattyn9-Aug-09 22:59 
QuestionRPG - character draw behind object problems [modified] Pin
jdneul9-Aug-09 11:12
jdneul9-Aug-09 11:12 
Ok here is a quick screenshot, from which you can see my top of my character has been rendered over

[IMG]http://i714.photobucket.com/albums/ww146/jneul/RPG_INVENTOR8-1.png[/IMG]

I hace a RPG game which works on a 3-layered map which is split into a grid (of rows and columns)
I can get my character making to work properly on simple objects such as a tree stump (just one cell),
and it works when you are moving down, but i get this problem when i move up, here is the code below:

public ArrayList detectTilesToRedraw(Rectangle srcArea, bool bUp)
        {
            ArrayList pTileRedrawList = new ArrayList();//array to hold objects which need redrawing
            int nTop = srcArea.Y / Map_Definitions.m_nCellHeight ; //will always get the bottom positon   
            //of the sprite
            
            //scan through our map layer cells
            for (int i = 0; i < m_pObjectList.Count; ++i)
            {
                Object pObj = m_pObjectList[i];//main array reperesents each row
                if (pObj is ArrayList)
                {
                    ArrayList pList = (ArrayList)pObj;//sub array represents each column
                    for (int j = 0; j < pList.Count; ++j)
                    {
                        Tile_Object pTile = (Tile_Object)pList[j];//get tile object at row i column j
                        Object pSubObj = pTile.getObject();//get the object held in the tile
                        if (pSubObj is Graphic_Object)// is it a graphic object (sprite)
                        {
                            Graphic_Object pGraphicObject = (Graphic_Object)pSubObj;//cast to graphic 
                            //object
                            int nTileTop = pGraphicObject.getPosition().Y / Map_Definitions.m_nCellHeight;
                            //if direction of character is down (not up)
                            if (!bUp)
                            {   
                                //add all graphic objects that are at the same position or are more than  
                                //the characteers positon (grid-wise)                             
                                if (nTileTop >= nTop)
                                {
                                    pTileRedrawList.Add(pGraphicObject);
                                }
                            }
                            //else direction of character is up
                            else
                            {
                                //add all graphic objects that are at the same position or are less than  
                                //the characteers positon (grid-wise)  
                                if (nTileTop <= nTop)
                                {
                                    pTileRedrawList.Add(pGraphicObject);
                                }
                            }

                        }
                    }
                }
            }

Obviously i need some smarter code for when i move up as sometimes different objects are required to be drawn when the character is in different positions

modified on Sunday, August 9, 2009 7:29 PM

AnswerRe: RPG - character draw behind object problems Pin
Luc Pattyn9-Aug-09 11:41
sitebuilderLuc Pattyn9-Aug-09 11:41 
AnswerRe: RPG - character draw behind object problems Pin
harold aptroot9-Aug-09 12:28
harold aptroot9-Aug-09 12:28 
GeneralRe: RPG - character draw behind object problems Pin
jdneul9-Aug-09 12:59
jdneul9-Aug-09 12:59 
GeneralRe: RPG - character draw behind object problems Pin
Luc Pattyn9-Aug-09 13:05
sitebuilderLuc Pattyn9-Aug-09 13:05 
GeneralRe: RPG - character draw behind object problems Pin
harold aptroot9-Aug-09 13:14
harold aptroot9-Aug-09 13:14 
AnswerRe: RPG - character draw behind object problems Pin
jdneul10-Aug-09 4:40
jdneul10-Aug-09 4:40 
QuestionTalking to a telnet server [modified] Pin
shultas9-Aug-09 8:21
shultas9-Aug-09 8:21 
AnswerRe: Talking to a telnet server Pin
Randor 9-Aug-09 9:41
professional Randor 9-Aug-09 9:41 
GeneralRe: Talking to a telnet server Pin
shultas9-Aug-09 9:54
shultas9-Aug-09 9:54 
GeneralRe: Talking to a telnet server Pin
shultas9-Aug-09 10:00
shultas9-Aug-09 10:00 
GeneralRe: Talking to a telnet server Pin
Luc Pattyn9-Aug-09 10:30
sitebuilderLuc Pattyn9-Aug-09 10:30 
GeneralRe: Talking to a telnet server Pin
Randor 9-Aug-09 10:32
professional Randor 9-Aug-09 10:32 
Question[Message Deleted] Pin
spankyleo1239-Aug-09 6:13
spankyleo1239-Aug-09 6:13 
AnswerRe: InsertOnSubmit error Pin
Luc Pattyn9-Aug-09 6:28
sitebuilderLuc Pattyn9-Aug-09 6:28 
General[Message Deleted] Pin
spankyleo1239-Aug-09 6:35
spankyleo1239-Aug-09 6:35 
GeneralRe: InsertOnSubmit error Pin
Luc Pattyn9-Aug-09 6:41
sitebuilderLuc Pattyn9-Aug-09 6:41 
QuestionForms overlapping Pin
Xmen Real 9-Aug-09 5:16
professional Xmen Real 9-Aug-09 5:16 

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.