I'm currently working on a 2D (vector based) game, and I of course want the players to be able to choose any resolution they wish. While I've successfully managed to scale the graphics properly, I can't seem to figure out how to scale the physics.
Take a look at this simple projectile code to get a better understanding of what I mean:
[source lang="vb"]bullet.gravity = 0.5
bullet.speed = 1
IF bullet.stage = 1 THEN
bullet.x = turret.x2
bullet.y = turret.y2
bullet.xVel = COS(bullet.angle / 180 * Pi) * (bullet.power / bullet.speed)
bullet.yVel = SIN(bullet.angle / 180 * Pi) * (bullet.power / bullet.speed)
bullet.stage = 2
ELSEIF bullet.stage = 2 THEN
bullet.x = bullet.x + bullet.xVel
bullet.y = bullet.y + bullet.yVel
IF bullet.yVel < 12 THEN bullet.yVel = bullet.yVel + (bullet.gravity / (bullet.speed * bullet.speed))
Let's say I'm running the game in 640x480, if [source lang="vb"]bullet.power = 20.5[/source] and [source lang="vb"]bullet.angle = 270[/source] (straight up), the 'bullet' will roughly reach a height of around 480 (well, technically 0, as 480 is the bottom, and 0 is the top). Now if I were to run the game in 800x600, the 'bullet' would of course, still only reach around 480, whereas I would want it to reach around 600 (and take the same amount of time to do so). I'm unsure as to what the math would be to achieve this. I've tried various ways, but nothing seems to give the desired affect.
Any help would be greatly appreaciated