I’m working on a mobile platformer and I would like it to be compatible with older devices like Samsung Galaxy NeoGT or Samsung Galaxy S2.
Problem:
The character moves with a virtual joystick at an average speed of 90x but this speed is not enough with the average 23fps offered by the test device and the character moves too slowly.
Objetive:
Multiply the speed of the player by the value of the oldDeviceValue variable, which will be 1 for a modern device (56-60fps) or 2 for an old device (18-45fps), as follows:
function detectOldDevice() {
return /* anything for make old device detection (must be 1 or 2) */
}
•••
movePlayer: function () {
var oldDeviceValue = detectOldDevice();
// for example:
if (cursors.left) {
this.player.speed.x = ( this.joystick.speed.xoldDeviceValue)-1;
}
}
The equation would be:
VelXPlayer = [VelXJoystick * (oldDeviceValueResult)] * -1