After reading a recent posting on tweening to get a constant game speed I have given it a go, but I am little stuck now.
Tweening works but has an unanticipated effect. In my game if an object gets too far away from the player it get wrapped around to the other side of the player. I use positionentity followed by resetentity to acheive this. And it was all working fine till I implemented the tweening code.
You now get glimpses of the objects as they flick past, I kinda understand why this happens but I am a loss on how to stop it. I have tried hiding the entity before the position and showing it after, but this makes not difference (and i kinda understand why this happens too).
Any ideas?
The offending code looks like this at the moment (just the move bit)
Tweening works but has an unanticipated effect. In my game if an object gets too far away from the player it get wrapped around to the other side of the player. I use positionentity followed by resetentity to acheive this. And it was all working fine till I implemented the tweening code.
You now get glimpses of the objects as they flick past, I kinda understand why this happens but I am a loss on how to stop it. I have tried hiding the entity before the position and showing it after, but this makes not difference (and i kinda understand why this happens too).
Any ideas?
The offending code looks like this at the moment (just the move bit)
For stuff.blitz_obj = Each blitz_obj If Abs(EntityX (stuff\mesh)-EntityX(player_mesh)) > bound Then HideEntity(stuff\mesh) If EntityX (stuff\mesh) < EntityX(player_mesh) Then PositionEntity (stuff\mesh,EntityX(stuff\mesh)+(bound*2),EntityY(stuff\mesh),0) Else PositionEntity (stuff\mesh,EntityX(stuff\mesh)-(bound*2),EntityY(stuff\mesh),0) EndIf ShowEntity(stuff\mesh) ResetEntity stuff\mesh EndIf If Abs(EntityY (stuff\mesh)-EntityY(player_mesh)) > bound Then HideEntity (stuff\mesh) If EntityY (stuff\mesh) < EntityY(player_mesh) Then PositionEntity (stuff\mesh,EntityX,EntityY(stuff\mesh)+(bound*2),0) Else PositionEntity (stuff\mesh,EntityX,EntityY(stuff\mesh)-(bound*2),0) EndIf ShowEntity (stuff\mesh) ResetEntity stuff\mesh EndIf TranslateEntity (stuff\mesh,stuff\xv,stuff\yv,0) Next