Open GoogleCodeExporter opened 8 years ago
How do you change issue type from Defect to Enhancement?
Original comment by h3liumdr...@gmail.com
on 8 Nov 2010 at 6:06
I am using the CDK in my code, and figured out a way to perform my own sweep
tests!
in my game, when you enter a frame, a tick function is invoked on things like
ships and shots, this handles their movement.
i was having a problem with fast moving shots, the point at which they would
collide with an object was not on a frame - so often the shots would cruise
right past the target.
the issue here is where and when the checkCollision is called.
previously I was calling onEnterFrame.
the solution - during my tick function, there is a timestamp.
you can keep track of when the last tick, and subtract that from the current
tick to keep track of the offset.
the offset is how many miliseconds have past since the last frame(tick).
for( var a:int=0;a<offset;a++){ //this code will execute once per milisecond,
durring the time between frames. this keeps my bullets moving at constant
pace, regaurdless of framerate.
so i use this loop, and call for collisionChecks there. essentially this
allows you to call collisionChecks between frames.
Original comment by h3liumdr...@gmail.com
on 8 Nov 2010 at 8:06
Original issue reported on code.google.com by
h3liumdr...@gmail.com
on 8 Nov 2010 at 6:05