How do I clone AnimatedSprites in dgdk.net?
in dbp, I can use the clone command to copy animated sprites.
but, in darkgdk.net (1.2 - may 09), the basic2d.animatedsprite class inherits its clone method from basic2d.sprite. I get a type cast error. I even tryed using CType() and got the same error.
my test code:
Module SpriteTest
Sub Main()
DarkGDK.Engine.InitializeGDK()
DarkGDK.Display.SetDisplayMode(800, 600, 16)
Dim animSpr1 As DarkGDK.Basic2D.AnimatedSprite
animspr1 = New DarkGDK.Basic2D.AnimatedSprite("meteor_4.bmp", 5, 6)
Dim animSpr2 As DarkGDK.Basic2D.AnimatedSprite
animSpr2 = animSpr1.Clone
While DarkGDK.Engine.LoopGDK = True
DarkGDK.Core.Sync()
End While
End Sub
End Module
the exception:
Quote: "
System.InvalidCastException was unhandled
Message=Unable to cast object of type 'DarkGDK.Basic2D.Sprite' to type 'DarkGDK.Basic2D.AnimatedSprite'.
Source=Meteors-DGDKNET
StackTrace:
at Meteors_DGDKNET.SpriteTest.main() in C:\projects\games\mine\Meteors\Meteors-DGDKNET\Meteors-DGDKNET\SpriteTest.vb:line 12
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
"
The error list reports:
Quote: "
Value of type 'DarkGDK.Basic2D.Sprite' cannot be converted to '1-dimensional array of DarkGDK.Basic2D.AnimatedSprite'.
"