检索graphics.drawimage的数量 [英] retrieving number of graphics.drawimage
问题描述
我对编程很陌生,所以决定制作一个游戏来使用 - 编码过程现在我正在制作一个泡泡巫婆传奇的骗局,我试图找出哪个我在游戏中已经拥有的彩色气泡这是我到目前为止在''''之间的部分
是我遇到任何想法的部分?
I am kind of new to programming so decided to make a game to get use-to the coding process right now i'm making a rip-off of bubble witch saga and i'm trying to figure out which color bubbles I already have in the game this is what I got so far the part in between the ''''' is the part I am having trouble with any ideas?
私人功能getcolor()
      Dim sceem As Array = {0,0,0,0,0,0,0}¥b $ b      昏暗的绿色,蓝色,红色,紫色,黄色,白色,黑色作为整数
     对于form1中的每个'''' 图像
Private Function getcolor()
Dim sceem As Array = {0, 0, 0, 0, 0, 0, 0}
Dim green, blue, red, purple, yellow, white, black As Integer
For Each ''''' image in form1
              选择案例图片
select case image
                    case = green
case = green
                        sceem + = {1,0,0,0,0,0,0}
sceem +={1,0,0,0,0,0,0}
                    case = blue
case = blue
                          sceem + = {0,1,0,0,0,0,0}
sceem +={0,1,0,0,0,0,0}
''''''
             下一个
     返回场景¥b $ b  结束功能
Next
Return sceem
End Function
Public Sub drawrow(ByVal Amount As Integer)
      Dim Rect As New Rectangle
      Dim X,Y As Integer
      Dim Img As Bitmap
      Dim Count As Integer
      G = Form1.CreateGraphics
      Y = 0
     对于X = 0到13
          Count = rnd.Next(金额+ 1)
         选择案件数量
             案例= 0
                  Img =新位图(My.Resources.GreenOrb)
             案例1
                  Img =新位图(My.Resources.BlueOrb)
             案例2
                  Img =新位图(My.Resources.RedOrb)
             案例3
                  Img =新位图(My.Resources.PurpleOrb)
             案例4
                  Img =新位图(My.Resources.YellowOrb)
             案例5
                  Img =新位图(My.Resources.WhiteOrb)
             案例6
                  Img =新位图(My.Resources.BlackOrb)
              Case Else
                  Img =新位图(""")
         结束选择
          Rect =新矩形(X * 50,Y * 50,50,50)
          G.DrawImage(Img,Rect)
     下一页
 结束子
Public Sub drawrow(ByVal Amount As Integer)
Dim Rect As New Rectangle
Dim X, Y As Integer
Dim Img As Bitmap
Dim Count As Integer
G = Form1.CreateGraphics
Y = 0
For X = 0 To 13
Count = rnd.Next(Amount + 1)
Select Case Count
Case = 0
Img = New Bitmap(My.Resources.GreenOrb)
Case 1
Img = New Bitmap(My.Resources.BlueOrb)
Case 2
Img = New Bitmap(My.Resources.RedOrb)
Case 3
Img = New Bitmap(My.Resources.PurpleOrb)
Case 4
Img = New Bitmap(My.Resources.YellowOrb)
Case 5
Img = New Bitmap(My.Resources.WhiteOrb)
Case 6
Img = New Bitmap(My.Resources.BlackOrb)
Case Else
Img = New Bitmap("")
End Select
Rect = New Rectangle(X * 50, Y * 50, 50, 50)
G.DrawImage(Img, Rect)
Next
End Sub
推荐答案
Aaron,
Aaron,
您应该列出您绘制的图像。然后,您可以轻松搜索绘制的图像列表。
You should make a list of the images you have drawn. Then you can easily search the drawn images list.
例如,在您绘制greenorb的选择情况下,使用您在选择案例中为图像颜色设置的索引, 当黄色圆球将值4添加到绘制的图像列表时,将绿色值0添加到整数列表。现在你知道绿色和黄色已经被使用,如果你搜索列表。
For example in your select case when you draw greenorb, use the indexes you have set up in the select case for the image colors, add the value 0 for green to a list of integers, when yellow orb add the value 4 to the drawn images list. Now you know green and yellow have been used if you search the list.
比你尝试恕我直言要容易得多。最好拥有一组数据然后操纵数据。图像太难用于保存数据(图像除外),尤其是你用颜色做的事情。
Much easier than what you are trying IMHO. Best to have a set of data and then manipulate the data. Images are too hard to use to hold data (other than the image) especially what you are doing with colors.
这篇关于检索graphics.drawimage的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!