Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

160 Neutral

About luke88

  • Rank
  1. luke88

    Scaling physics with screen resolution

    Wow, that's so simple, thank you very much. I'm a bit annoyed at myself for not thinking of that. I've not tested it properly yet as my graphics scaling code works in a completely different, and ridiculous way, and I'm having to go back and change everything, but my preliminary tests suggests that it should all work fine Thanks again Mussi. If I don't follow-up this post with new problems, it's safe to assume that it was all a success.
  2. 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 SUB projectilePhysics 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)) END IF END SUB[/source] 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
  3. First time back on gamedev in years, and all I can say is, what the hell happened?
  4. luke88

    I'm back

    Welcome back! Hope you had a good christmas and new years.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!