Game Development Community

object loads in one position and unexplainably switches

by rennie moffat · in iTorque 2D · 08/26/2010 (2:12 am) · 3 replies

Hi there i have a quick question that maybe some one can answer. I have an object bigBox. It is the owner of a behavior. In that behavior are 5 t2dSceneObjects called "trailer1, trailer2..." . OnlevelLoaded I set the 5 trailers to be at position of startTile, another t2dSceneObject in that same behavior. My echos return that onLevelLoaded that the 5 trailers are indeed at the same position as startTile, however, this changes. I know this because after a mini schedule I run, and thru echo tests that trailers 2-5 "pop out" meaning they move position... which is out of position.


These trailers have no collisions set, no physics, they are simply t2dSceneObjects, slave the player input. So even with no input they move out of position.


here is the echo I am receiving....
bigBoxClass::onLevelLoaded+++++++++++++++++++++++++++++++
%startTilePos6.835000 -5.227000
%trailer1Pos6.835000 -5.227000
%trailer2Pos6.835000 -5.227000
%trailer3Pos6.835000 -5.227000
%trailer4Pos6.835000 -5.227000
%trailer5Pos6.835000 -5.227000

bigBoxClass::update+++++++++++++++++++++++++++++++
%trailer1Pos6.835000 -5.227000
%trailer2Pos-0.493000 -0.365000
%trailer3Pos-0.493000 -0.365000
%trailer4Pos-0.493000 -0.365000
%trailer5Pos-0.493000 -0.365000



Can anyone explain this?

About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.


#1
08/29/2010 (8:22 pm)
nobody has any insight on this?
#2
08/30/2010 (12:24 am)
Rennie, I think there must be a bug somewhere in your script. As a test, you could try using "setImmovable(true)" on all of those objects to see if that makes any difference. If that does make a different it would suggest that you have enabled physics somewhere in your code and done something to move them. That would be a quick test. Other than that, the only other thing I can suggest is to place echo statements to print out the object positions at various points in your scripts. That would enable you to trace through your code and find the point at which they move.

#3
08/30/2010 (12:26 am)
Hmm. ok thanks, I will try that.