David

David

  • NA
  • 1
  • 14.3k

Creating and Managing game objects?

Jan 17 2011 4:08 PM
Hello everyone. I've been desperately trying to learn and understand this missing link to really get my game development started and I haven't found an ounce of help or useful information. I'm using XNA 3.1 and i'm trying to start off by first making a flat level of blocks with an HP value. So far, this is the code in my head (in simple format):

class level
{
createlevel()
createboundingbox()
int levelheight
int levelwidth
int leveldepth
}

level.createlevel()
{
for (int y = 0; y < levelheight; y++)
  for (int x = 0; x < levelwidth; x++)
    for (int z = 0; z < leveldepth; z++)
[create vertices for each box using a vertexpositionnormaltexture list]
[after a box is created, create a bounding box for this block and assign it an HP value using a boundingbox list that has an int value by calling it's code with createboundingbox() (or is this not allowed? i mean calling a class's method inside one of it's methods?)]
}

Using this, would I be able to do a mouse pointer ray collision test that I could have a HUD display information for?
How do I setup the bounding box list properly so it's data can be called to the HUD via the collision test? How do I access the right bounding box when I perform the ray collision test? Can I even create a bounding box list using new Vector3(new Vector3(x1,y1,z1), new Vector3(x2,y2,z2), new int)?

I know i'm just missing this one thing to really get started, and I'm really trying to learn :(

If it helps with your answer, I'm basically just trying to make a block, and when I click on it, it will tell me how much HP it has. I want to do this thousands of times with random HP values. Thanks.