Here is something that might be useful to you as well:
Strict
Global SpriteList:TList = CreateList()
Type tSprite
Field Image:TImage
Field Mode:Int
Field ScaleX:Float
Field ScaleY:Float
Field Angle:Float
Field Alpha:Float
Field Tint:Int [3]
Function Create:tSprite (_Image:TImage, _Mode:Int = ALPHABLEND)
Local o:tSprite = New tSprite
o.Image = _Image
o.Mode = ALPHABLEND
o.ScaleX= 1.0
o.ScaleY= 1.0
o.Angle = 0.0
o.Alpha = 1.0
o.Tint = [255,255,255]
SpriteList.AddLast(o)
Return o
End Function
Method Render (_X:Float, _Y:Float, _Frame:Int = -1)
Local _ScaleX:Float, _ScaleY:Float, _Angle:Float
Local _Alpha:Float, _Mode:Int, _Tint:Int [3]
_Angle = GetRotation ()
_Alpha = GetAlpha ()
_Mode = GetBlend ()
GetScale _ScaleX,_ScaleY
GetColor _Tint[0],_Tint[1],_Tint[2]
SetScale ScaleX, ScaleY
SetRotation Angle
SetAlpha Alpha
SetBlend Mode
SetColor Tint[0], Tint[1], Tint[2]
If _Frame = -1 Then _Frame = 0
DrawImage Image, _X, _Y, _Frame
SetScale _ScaleX, _ScaleY
SetRotation _Angle
SetAlpha _Alpha
SetBlend _Mode
SetColor Tint[0], Tint[1], Tint[2]
End Method
End Type So your game code could look like this:Graphics 800,600,0
Local MyImage:TImage = LoadImage("image.png")
Local MySprite:tSprite = tSprite.Create(MyImage)
MySprite.Alpha = .8
MySprite.Angle = 90
MySprite.ScaleX = .5
MySprite.ScaleY = .5
MySprite.Tint = [255,128,0]
While Not KeyHit(KEY_ESCAPE)
Cls
MySprite.Render(MouseX(), MouseY())
Flip
FlushMem
Wend
|