绘制精灵错误 [英] Drawing Sprite Error
问题描述
我正在使用Visual Basic Professional 2010制作一个Bejeweled游戏(它是一个名为 Scoontz 的网络浏览器的一部分),我在尝试绘制一个精灵时偶然发现了一个错误:
DrawSprite不是Scoontz.Sprite的成员
这是代码(含有问题的行以粗体显示):
'注意,此函数不会更新单元格的REAL位置。
Public Sub DrawCell(ByVal Surface As Graphics,ByVal Cell As Cell,_
可选ByVal背景为布尔值= True)
'取回作品
使用Pieces(Cell.PieceIndex)
'绘制背景
如果背景则
DrawBackground(Surface,New RectangleF(Cell.Position.X,Cell.Position.Y,_
Cell.Piece.Sprite.Width,Cell .Piece.Sprite.Height))
结束如果
'确保作品索引有效
如果Cell.Visible那么
'将特定的精灵画到一个计算区域上
用.Sprite
。 ImageAttributes = Cell.ImageAttributes
.DrawSpirte(Surface,Cell.Position.X + Cell.Offset.X,Cell.Position.Y + Cell.Offset。 Y)
结束
结束如果
结束用
结束子
注意,我被建议添加一个通用的方法来绘制精灵,但在尝试调试程序时,它引发了异常错误。我需要知道如何修复此错误,以便宝石迷阵游戏程序可以绘制精灵。
I am making a Bejeweled game in Visual Basic Professional 2010 (which is apart of the web browser known as Scoontz) and I stumbled across an error when trying to draw a sprite:
DrawSprite is not a member of Scoontz.Sprite
Here is the code (with the line in question in bold):
' Note that this function does NOT update the REAL postion of the cell.
Public Sub DrawCell(ByVal Surface As Graphics, ByVal Cell As Cell, _
Optional ByVal Background As Boolean = True)
' Retrieve the piece
With Pieces(Cell.PieceIndex)
' Draw its background
If Background Then
DrawBackground(Surface, New RectangleF(Cell.Position.X, Cell.Position.Y, _
Cell.Piece.Sprite.Width, Cell.Piece.Sprite.Height))
End If
' Make sure the piece index is valid
If Cell.Visible Then
' Draw the specific sprite onto an caculated area
With .Sprite
.ImageAttributes = Cell.ImageAttributes
.DrawSpirte(Surface, Cell.Position.X + Cell.Offset.X, Cell.Position.Y + Cell.Offset.Y)
End With
End If
End With
End Sub
Note, I was suggested that add a general method to draw the sprite, but when trying to debug the program, it threw an exception error. I need to know how can I fix this error so that the Bejeweled game program can draw sprites.
推荐答案
这篇关于绘制精灵错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!