10-23-2001, 07:56 PM
Hi, i recently picked up VB and i have decided to develop Bomberman, the thing i dont know is how to load and unload images to create the effect of a bomb exploding and the blocks around it disappear. Not sure how i should go about coding the radius of the explosion & how it will affect the blocks around it. I hope some of you guys can fix this.
10-23-2001, 07:57 PM
Hmm... Maybe you could try setting some stuff and variables. Make sure the stuff is there.
10-24-2001, 06:45 AM
You might actually find examples of bomberman written in VB on www.vbdiamond.com. There are plenty of examples on that site.
10-24-2001, 07:39 AM
The answers to questions like this will vary depending on your preferred display method. You would need to do different things depending on if you were using BitlBlt, DirectX, or arrays of Pictureboxes.........
10-26-2001, 02:32 AM
what you could do is draw an explosion..
For i = 1 to 10
10-26-2001, 05:47 AM
For i = 1 to 10
can u explain this code more detailed coz its confusing this way i mean, what is rgb, what is i and the values that u have assigned like (100, 100) and (100,i,0) images/icons/smile.gif
10-26-2001, 08:29 AM
RGB is a function that is used for creating colours (colors in US).
It has 3 paramters/arguments. The <font color=red>red</font color=red> compnent, <font color=green>green</font color=green> component, and <font color=blue>blue</font color=blue> component. Each value can be from 0 to 255
So, If I want a totally blue colour, I use:
<pre>RGB(0, 0, 255)</pre>
For plain red I use:
<pre>RGB(255, 0, 0)</pre>
For white and black I can use:
<pre>RGB(255, 255, 255) 'White
RGB(0, 0, 0) 'Black</pre>
The code posted by andrewo merely creates a circle which gradually increases in size and gradually turns from red to yellow and it gets bigger.
The circle command is a graphics command. We specify the object we want to draw the circle onto:
<pre>Form1.Circle(100, 100), 10</pre>
This would create a circle at point (x,y) 100, 100 on the form, with a radius 10. I have specified no colour and so it will be black. The x,y co-ordinate (100,100) is where the centre of the circle will be.
Again, what andrewo's code does is draw a circle with a centre at point (100, 100) and then with a gradualy increasing radius, and the colour gradually changes from red through to yellow.
10-26-2001, 11:54 AM
hey e_bluez, why dun u attach ur game, maybe i could have a look at it and get u an answer images/icons/smile.gif
10-26-2001, 02:25 PM
This gives a nice little explosion. I fiddled for a while, but i suggest using a couple of small graphics and <font color=red>BitBlt</font color=red> to animate them.
<pre><font color=red>Private Sub Command1_Click()
For i = 0 To 25
' draw the first circle
Form1.Circle (75, 75), i, RGB(255, i * 10, 0)
' do nothing (to slow down the explosion
' change the number of "doevents" to
' slow down or speed up the explosion
DoEvents: DoEvents: DoEvents
' redraw the center circles -
' expanding effect gives an
If i - 10 > 0 Then
Form1.Circle (75, 75), i - 10, Form1.BackColor
' clear the eplosion
10-26-2001, 02:30 PM
i have been reading alot on BitBlt , can someone please explain what its all about, thanx
10-27-2001, 02:17 PM
BitBlt stands for <font color=red>Bit Bl</font color=red>ock <font color=red>T</font color=red>ransfer. Its basically an extremely fast transfer of a bitmap from one device context to another.
Say you had two pictureboxes, you could set picture of the second like this:
<pre><font color=red>Picture2.Picture = Picture1.Picture</font color=red>
</pre>Or you could do it via BitBlt
<pre><font color=red>BitBlt Picture2.hDC,0,0,iWidth,iHeight,Picture1.hDC,0,0,vbSrcCopy
</font color=red></pre>would produce the same effect. Its best used for doing lots of image manipulations in memory without using pictureboxes. You can create virtual bitmaps and device contexts, and transfer images between them.
For animation - you BitBlt an image to one visible DC, then BitBlt a slightly different image over the top, and then another etc ....
10-28-2001, 12:07 PM
If you are Blting to a picture box with its AutoRedraw property set you will need to call the refresh method after the Bitblt call.
10-28-2001, 12:25 PM
wow thats quite confusing, seems like ur speaking an alien language
10-28-2001, 12:35 PM
Well, if you have the AutoRedraw property of the picturebox set to true then the picbox has 2 Device Contexts. One is visible (ie. the bit you see) and the other hold the picture that is copied to the visible one when the picture box is repainted.
E.g.; If you move another window over the picturebox then when it is moved off of the picbox, if the autoredraw property is false then the image disappears. If it True then the hidden device context is copied to the visible one.
This is done automatically when using the picbox's methods but BitBlt isn't one of these. The picbox.hDC refers to the hidden DC when the autoredraw property is set to True. Therefore after the BitBlt call you need to call Picbox.Refresh to force the data you've just BitBlted (which is in the hidden DC) to be copied to the visible DC.
Hope that clears things up.
10-31-2001, 02:15 PM
great reply im sure he found that helpful