EDN Admin
Well-known member
Im trying to make a Pac Man Game. I have 2 pictureboxes one is blank and i the size of the form and the other has this image: www.kaldobsky.com/pacmansprites
as you can see there is one blank 30,30 portion,which is at the top left, then right to the right of it is the 30,30 portion that I need to copy(the smallest yellow dot) so the form when I run it will look like the pacman map without the walls.So Basically I need the program to take that portion on the image in picturebox2 and copy it until the whole picturebox1 is filled and looks like there is yellow dots all over with a black background. this is the code that draw the dots but it is in vb 2006 and gives me this error on the last two 30s(they are underlined):Value of type Integer cannot be converted to System.Drawing.Imaging.ImageAttributes
CODE: Dim tile(20, 20)
Dim tilea(20, 20)
Dim tileb(20, 20)
Dim a
Dim b
Dim d
Dim d2
Dim ani
Dim ga(4)
Dim gb(4)
Dim gc(4)
Dim gd(4)
Dim score
Dim selecta
Dim selectb select tiles
Dim staring
Dim dying
Dim super
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For z = 1 To 20
For w = 1 To 20
tile(z, w) = 1
tilea(z, w) = 1
tileb(z, w) = 0
Next w
Next z
Call drawscreen()
End Sub
Public Sub drawscreen()
For z = 1 To 20
For w = 1 To 20
Call drawtile(z, w)
Next w
Next z
End Sub
Public Sub drawtile(ByVal z, ByVal w)
Call PictureBox1.CreateGraphics.DrawImage(PictureBox2.Image, (z - 1) * 30, (w - 1) * 30, 30, 30, tilea(z, w) * 30, tileb(z, w) * 30,30, 30)
End Sub
View the full article
as you can see there is one blank 30,30 portion,which is at the top left, then right to the right of it is the 30,30 portion that I need to copy(the smallest yellow dot) so the form when I run it will look like the pacman map without the walls.So Basically I need the program to take that portion on the image in picturebox2 and copy it until the whole picturebox1 is filled and looks like there is yellow dots all over with a black background. this is the code that draw the dots but it is in vb 2006 and gives me this error on the last two 30s(they are underlined):Value of type Integer cannot be converted to System.Drawing.Imaging.ImageAttributes
CODE: Dim tile(20, 20)
Dim tilea(20, 20)
Dim tileb(20, 20)
Dim a
Dim b
Dim d
Dim d2
Dim ani
Dim ga(4)
Dim gb(4)
Dim gc(4)
Dim gd(4)
Dim score
Dim selecta
Dim selectb select tiles
Dim staring
Dim dying
Dim super
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For z = 1 To 20
For w = 1 To 20
tile(z, w) = 1
tilea(z, w) = 1
tileb(z, w) = 0
Next w
Next z
Call drawscreen()
End Sub
Public Sub drawscreen()
For z = 1 To 20
For w = 1 To 20
Call drawtile(z, w)
Next w
Next z
End Sub
Public Sub drawtile(ByVal z, ByVal w)
Call PictureBox1.CreateGraphics.DrawImage(PictureBox2.Image, (z - 1) * 30, (w - 1) * 30, 30, 30, tilea(z, w) * 30, tileb(z, w) * 30,30, 30)
End Sub
View the full article