Game Development Community

Problem getting proper object location in an engine component

by Dave Calabrese · in iTorque 2D · 05/29/2009 (2:22 am) · 3 replies

For my game, I have an engine level component that allows my player object to jump. To do this, I apply an impulse to the player, record their y coordinate, then on each update in the engine component, check and see if we are at or beyond the stored y position. It does work, however is far from accurate. I'm watching the land position always be about 2 points lower than the stored. Being called every 32ms, it seemed like it was frequent enough to be used to handle accurate coordinate handling but now I'm not so sure... Anyone have any thoughts on that?

#1
05/29/2009 (6:04 am)
Looks like there really is no way to do this in the engine components. It's just too slow... this really needs to be done in the collision handling code. Which led me to the discovery of a handy little method called "setPositionTarget", which does exactly what I needed. Good going for forward-thinking whomever programmed that one in! :D
#2
05/29/2009 (6:16 am)
*takes a bow* ;)
#3
05/29/2009 (7:34 am)
Yes the more I work with the Engine code the more impressed I am. It's really well written and easy to understand. I'm having a blast implementing my game. I do wish I'd created less inter-component dependencies and communication, it makes it a bear to get everything initialized before allowing objects to start performing actions. I should of had only a few components and then just utility classes they used instead of individual components so I could ensure the initialization and execution order. I might have to go back and re-org my code to fix this eventually, but it's working if a bit brittle at the moment.