you have to take care about, that the variable that contains the entity is still avaiable when try to position it. This will cause an error:
Graphics3D 800,600
...
Function LoadIt()
Sprite=LoadSprite("test.png")
End Function
Function MoveIt()
MoveEntity Sprite,1,0,0
End Function
Better: Declare the variable Sprite as Global:
Graphics3D 800,600
Global Sprite%
...
Function LoadIt()
Sprite=LoadSprite("test.png")
End Function
Function MoveIt()
MoveEntity Sprite,1,0,0
End Function
The second reason, why the entity does not exist, ist because the image was not found. You can test this with a additional code line:
if this does not work...
Graphics3D 800,600
Global Sprite%
...
Sprite=LoadSprite("test.png")
MoveEntity Sprite,1,0,0
and this works....
Graphics3D 800,600
Global Sprite%
...
Sprite=LoadSprite("test.png")
Sprite=CreateSprite()
MoveEntity Sprite,1,0,0
... the image was not found!
|