[.net] My Game Maker Help?

Started by
17 comments, last by bdubreuil 13 years, 5 months ago
Ok guys, i have been working on my game maker in vb for a long while now. But it works and i am happy. But i am lacking one feature i need "Blocks" to keep users from walking throught stuff now i have them tackled some what. The way it needs to work is simple. I need to save pictureboxes in a list of pictureboxes into the C:/ drive and then load them back into a list of pictureboxes. I know you can do this using xml. But is there another way. And if you could provide a code that would help a ton. Please Help. Thanks - civil
Advertisement
Don't use PictureBoxes, they're extra memory overhead that is completely unnecessary. For whatever object your drawing area is (your window, a panel control), call the CreateGraphics method and use the Graphics.DrawImage method to draw Bitmap objects that you load from BMP, PNG, or whatever image type files with either the Stream or String version of its constructor.

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

Yes, or perhaps even just BitBlt. I used that all the time when I programmed VB.
You can always abstract the geometry into some variables, and avoid pictureboxes.
As Cpt. Midnight said, they are extra memory overhead. I had a 32Mb Pentium machine
back in 2000 which I created a simple crafting game on, inspired by runescape.

It contained around a hundred pictureboxes, and ultimately, not all of the form would load:
The VB Designer would leave out some of the pictures... :/

It's common, good practice to seperate a game into more layers of graphics, business logic and backend storage. (And many, many variants of this.)
Guys, i am not using pictureboxes for images. I am using them for the control. For example when i figure out how to save them and load them back in i can use a code to tell if one picturebox hit another. Thats why i am using it. Just as a maker. Thats all. Please help me on how to save and load them. Thanks - civil
Could you explain to us how you are creating the maps? Are you using tiles? are the tiles moving on the map? In other words do you need the blocking areas to be moveable too?

Still, this
Quote:Original post by civilwarrock
i can use a code to tell if one picturebox hit another.

sounds a little suspicious.

You don't actually need to use pictureboxes for collision detection.
Do you have one for the bounding box of every sprite?
Maybe I'm just misunderstanding you.
Ok guys, well my game maker draws images onto a picturebox witch i use as a map. Then from there i save it and open it up in my game player. The map deos not move at all. But you have the option to put down blocks. Your char witch will be drawn on a form in game play just like the map. Now a emty picturebox follows the char were ever he geos. This is why i need to use pictureboxes so that if my picturebox following the char hits a standing still picturebox i can code a block. This all works ecept for the fact i need to be able to save pictureboxes and load them back in. Thanks - civil
Quote:Original post by SuperVGA
Still, this
Quote:Original post by civilwarrock
i can use a code to tell if one picturebox hit another.

sounds a little suspicious.

You don't actually need to use pictureboxes for collision detection.
Do you have one for the bounding box of every sprite?
Maybe I'm just misunderstanding you.


Can you please explain this bounding box methed for a sprite? Cause i think that may salve some problems. But how do i save them? - civil

Yes, alright.

Ok first thing would be to know how to blit a sprite or other 2d feature
onto your (preferrably doublebuffered) frame.

Secondly, the bounding boxes i mentioned can be used for instance if you have
Type MyBB  left  top  width  heightEnd Type

You check for overlapping instances of MyBB.

For instance, if the left component one corner of BB1 is higher than left of BB2, but lower than left+width of BB2
AND
the top component of same corner of BB1 is higher than the top of BB2,
but lower than top+height of BB2,
-then there's a collision. (Test for all corners to see if the rectangles overlap)

After that, you could test the masks of the sprites, or alpha values to do pixel-perfect collision test.

Am I making sense to you?
Unfortuinitly no, i dont get the

Type MBB
Left
Right
Top
Bottom
End Type

I dont get what this code deos and how to use. Thanks- civil

This topic is closed to new replies.

Advertisement