Hi, So I'm a good way into my first 'real' game and I've noticed a little bit of a problem, basically its an angry birds type physics game but with an educational theme, I have a cannon that shoots a ball and knocks the blocks!, all works fine on windows and my S5 however on my S4 Mini its suffers a framerate drop when the device is busy syncing and stuff and this causes the ball to lose motion almost like massive wind resistance and falls very very short of the target
I launch the ball with the below function and let the physics engine take care of the rest ......
Function LaunchBall(iIndex)
// get cannon position and move ball
cannonX# = GetSpriteXByOffset(gCannon.iCannon)
cannonY# = GetSpriteYByOffset(gCannon.iCannon)
//SetSpritePositionByOffset(ball.sprite, cannonX#, cannonY#)
// calculate trajectory
angle#=GetSpriteAngle(gCannon.iCannon)
vx#=cos(angle#)
vy#=sin(angle#)
newX# = cannonX# + vx#
newY# = cannonY# + vy#
ball as tBall
ball = gCannon.ball[iIndex]
SetSpritePositionByOffset (ball.iSprite, newX#, newY# )
SetSpriteVisible(ball.iSprite, 1)
// set force and launch
force# = 50000.0
velocityX# = ( newX# - cannonX# ) * force#*2
velocityY# = ( newY# - cannonY# ) * force#*2
SetSpritePhysicsVelocity ( ball.iSprite, velocityX#, velocityY# )
SetSpritePhysicsAngularVelocity ( ball.iSprite, 0.0 )
ball.isAirBorne = 1
gCannon.ball[iIndex] = ball
gGame.cStage = GAME_STAGE_FLIGHT
EndFunction
Is there anything I can do to make the physics movement tie in with the current framerate or do I need to update the balls position each frame?