mxschumacher Posted October 19, 2014 Report Share Posted October 19, 2014 Hi there,being new to JS and game development I have two questions (I'll create a post for each) regarding a implementation of Frogger I'm working on. Part of the images are taken from Udacity's OOP JS course, though I'm not enrolled in the program anymore (so you're not helping me cheat).1. In order to provide accurate scaling I use a scaling factor that I multiply image sizes with, e.g. var gameWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0) / 2.5;var gameHeight = gameWidth * 1.25;var scalingFactor = gameWidth / 800; //build for 800px width, actual screen-size via scalingvar rockBarrier = world.create(game.world.randomX, positionY, 'blockRock');rockBarrier.scale.set(scalingFactor);Yet collision does not scale in the same way, e.g. my player is ~80 px away from the rock and hits an invisible wall, same goes for collecting bonues (gems in my case) the collision function is triggered before my character actually touches the gem.The whole code-base can be found here: https://github.com/MaxSchumacher/FroschAny advice on how to fix this would be highly appreciated.Greetings,Max Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.