I am trying to draw an explosion. By draw, I mean using the e.graphics function as opposed to using a Picturebox(like I did last time).
Now my question is, that how exactly would I go about doing this? In my mind, I’m thinking of using the e.graphics.fillrectangle(x,y,w,h) and well…alterating the location and the colour to create a composite image which resembles an explosion. However, the process seems a bit hit and miss, since I have to experiment to try and do this – is there a way to do this more effectively?
You might find the FillPolygonPoint method to be more use.
Imagine all the points of your explosion like this:
Then the code to draw it looks something along the lines of:
As outlined in the documentation provided by Microsoft.
An algorithm (in C#) to create the points of a star dynamically might look like this:
Here’s the output…
You will have to translate this to Visual Basic and add some randomization to give it an explosive look. You could transpose (move) and scale the points through matrix multiplication.