Hi all
just wondering if someone can explain why this code give a stable result on a pc but a varied results on android using android player or converting to an apk , the ball ends up at random places on android , but same place on pc , press space to fire cannon
rem
rem AGK Application
rem
rem Landscape App
SetDisplayAspect( 4.0/3.0 )
`use w and s to angle canon and press space to shoot the canon ball
setVirtualResolution(800,480)
`create a canon
canon_spr = createSprite(0)
setSpriteSize(canon_spr,30,10)
setSpriteOffset(canon_spr,0,5)
setSpritePositionByOffset(canon_spr,10,300)
`create a canon ball
ball_spr = createSprite(0)
setSpriteSize(ball_spr,8,8)
setSpriteOffset(ball_spr,4,4)
setSpritePhysicsOn(ball_spr,2)
setSpritePhysicsMass(ball_spr,10)
`starting variables
canon_angle# = 315.0
ball_initial_speed# = 200
`set up physics
setPhysicsGravity(0,100)
do
setSpriteAngle(canon_spr,canon_angle#)
`press space to fire the canon ball
if getButtonPressed(1) = 1
setSpritePositionByOffset(ball_spr, 10,300)
x_velocity# = ball_initial_speed#*cos(canon_angle#)
y_velocity# = ball_initial_speed#*sin(canon_angle#)
setSpritePhysicsVelocity(ball_spr,x_velocity#,y_velocity#)
endif
Sync()
loop
thanks
mick