Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic (http://www.programmingforums.org/forum18.html)
-   -   Array help (game) (http://www.programmingforums.org/showthread.php?t=3952)

Enkiel May 17th, 2005 12:50 PM

Array help (game)
 
Ok, well I am fairly new, and I am working on that game where you are the paddle at the bottom of the screen and you break the blocks at the top of the screen. I am trying to put those blocks on an array, and make them "invisible", or basically gone when they are hit, however when they are hit, it seems to me that random ones disapear. Also when the blocks are all gone it gives me a "there is no element whatever integer" error kinda thing, I am kinda lost here, does anyone know how to explain arrays to someone who doesn't speak 10100010010101010110?

LOI Kratong May 17th, 2005 1:24 PM

Oh one of those people! You probably won't find many round here...

0x42 0x79 0x65, 0x42 0x79 0x65

LOI Kratong May 17th, 2005 1:25 PM

i think that's right, i'm not too good at hex (for those who are reading) ;)

Infinite Recursion May 17th, 2005 2:49 PM

I'm not to keen on the object collision algorithm you would use.... but for starters... You can preset all of the positions of the array representing the blocks to 1. Then, you can set the visible property of the component to false when it is hit and set the position in the array that represents that spot to 0. This will allow you to "skip" the blocks that have already been hit... hitting the next block in the ball's path. I think this is an old game called Paddle Wars for Atari that does this.

Enkiel May 17th, 2005 3:08 PM

To tell the truth I really suck at arrays, no one can put it into stupid terms for me, lol you just said abaabababalahab. Haha, thats about all it meant man, dumb it down, by this I mean when you say "position of the array" I say position?

Rory May 18th, 2005 3:20 PM

Are you using an array of VB shapes on a form, or simply an array of coordinates and drawing them yourself? I suspect that you're using shapes, as you wouldn't get this error otherwise. If you draw the whole thing using GDI for example you'd get better refresh rates, and none of the redraw problems of VB. Plus, when you get on to it, you could add custom variables for each block like mass, friction etc to the Type definition. Collision detection's a whole lot easier as well.


All times are GMT -5. The time now is 12:57 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC