Simple MAP Creator : 1 Credit
Please post all your completed software applications in here. This is for full software which you have created and wish to release and share with everyone.
7 posts
Page 1 of 1
You do not have the required permissions to view the files attached to this post.
Dude dude oh my god can you PLEASE tell me the grid code?? PLEASE! This is ALL I NEED FOR A GAME MAKER! Please man!
GoodGuy17 wrote:Dude dude oh my god can you PLEASE tell me the grid code?? PLEASE! This is ALL I NEED FOR A GAME MAKER! Please man!do it with graphics lol

dim gp graphicspath
dim gr as graphics
gp.addline(..a line in the grid..)
gp.addline(..next line..)
or
add a visualbasic.powerpack.rectangleshape
and watch the properties carefully there must be something that makes it a grid
I posted some grid code here a while back: viewtopic.php?f=32&t=2528&p=16055#p16055
mandai wrote:I posted some grid code here a while back: viewtopic.php?f=32&t=2528&p=16055#p16055
Code: Select all
Edit: I also created this code by request of GoodGuy17, might as well post it here:
Sub fillSqares(ByVal xCol As Single, ByVal yCol As Single, ByVal width As Single, ByVal height As Single, ByVal br As Brush)
For x As Single = xCol To xCol + width - 1
For y As Single = yCol To yCol + height - 1
gfx.FillRectangle(br, New RectangleF(x * blocksize + 1, y * blocksize + 1, blocksize - 1, blocksize - 1))
Next
Next
PictureBox1.Refresh()
End Sub
Code: Select all
Edit #2: RunarM has requested this code:'Allows the user to click to paint certain blocks.
Private Sub PictureBox1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseClick
Dim centering As Integer = blocksize / 2
Dim xCol As Integer = (e.X + centering) / blocksize - 1
Dim yCol As Integer = (e.Y + centering) / blocksize - 1
Dim sb As SolidBrush = New SolidBrush(Color.FromName(combobox1.text))
fillSqares(xCol, yCol, 1, 1, sb)
End Sub
Code: Select all
Edit #3:'Draws an image to the grid
Sub drawPictureSquares(ByVal xCol As Single, ByVal yCol As Single, ByVal width As Single, ByVal height As Single, ByVal img As Image)
For x As Single = xCol To xCol + width - 1
For y As Single = yCol To yCol + height - 1
gfx.DrawImage(img, New PointF(x * blocksize + 1, y * blocksize + 1))
Next
Next
PictureBox1.Refresh()
End Sub
Code: Select all
'Allows an image to be drawn pixel by pixel
Sub drawImagePixels(ByVal xCol As Integer, ByVal yCol As Integer, ByVal filename As String)
Dim bmp As Bitmap = Bitmap.FromFile(filename)
For x As Integer = 0 To bmp.Width - 1
For y As Integer = 0 To bmp.Height - 1
Dim c As Color = bmp.GetPixel(x, y)
Dim sb As SolidBrush = New SolidBrush(c)
fillSqares(x + xCol, y + yCol, 1, 1, sb)
Next
Next
bmp.Dispose()
PictureBox1.Refresh()
End Sub
7 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023