Jump to content
  • Advertisement
Sign in to follow this  
civilwarrock

[.net] My Game Maker Help?

This topic is 2799 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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
height
End 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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!