Hello, I have a physics box that I rotate around my player in a direction based on his direction.
My rotation works fine and physics is fine, just its all based on timers and sometimes it appears to stop/rotate at different times making it very inconsistent. Would like it to work the same every time will being optimized.
Pretty much I have my player swing around a giant hammer thing. It goes around the player and has a small physics box so I want it to go around in a certain time frame.
Here is the code:
game.actionPlayer\_4:setLinearVelocity(0, 0); if m == "d" then -- Check direction this instance the player is facing down! game.actionPlayer\_4.rotation = 180; player:setSequence("scD"); timer.performWithDelay( 5, function() game.actionPlayer\_4:setLinearVelocity(150, -150); end, 1 ) timer.performWithDelay( 150, function() game.actionPlayer\_4:setLinearVelocity(-150, -150); end, 1 ) timer.performWithDelay( 300, function() game.actionPlayer\_4:setLinearVelocity(-150, 150); end, 1 ) timer.performWithDelay( 500, function() game.actionPlayer\_4:setLinearVelocity(150, 150); end, 1 )
Timers appear to move physics box with different results every time! It gets the job done but I want it consistent.
Thanks for help!