Scale Map to Game Size
This is a plugin in development, while I work out if this is the best way to about it. Nonetheless at the moment it seems to work, thus consider this some kind of Alpha. Needless to say, not recommended for a live game yet.
Description
When combined with my Fit to Browser Window Plugin, this plugin makes the game map scale based on the size of the browser window.
There are a few variables you can set, such as:
- The basic size of the game window. The game scales based on this. So, if you set it as 640x480, then at this size the zoom level will be 1.0, but at 320x240 the zoom level will be 0.5, etc.
- Maintain Aspect Ratio, which keeps the square tile shapes if set to true. Otherwise it will set the tile size based on the size of the game window (stretchiness). True recommended.
Basically lets the player choose how big to play their game in. If done right they can even use F12 to play a browser game in full screen.
Dependencies
This is a complimentary plugin to Fit to Browser Window and doesn't make much sense without it:
https://forums.rpgmakerweb.com/index.ph ... dow.75199/
Further, it requires the plugin MBS - Map Zoom:
https://forums.rpgmakerweb.com/index.ph ... oom.48267/
You will need to setup the MBS - Map Zoom plugin with "Reset on Map Change" as false.
Screenshots
Default size set to 640x480, shown in various different browser windows.
Script - Alpha
This is a plugin in development, while I work out if this is the best way to about it. Nonetheless at the moment it seems to work, thus consider this some kind of Alpha. Needless to say, not recommended for a live game yet.
Description
When combined with my Fit to Browser Window Plugin, this plugin makes the game map scale based on the size of the browser window.
There are a few variables you can set, such as:
- The basic size of the game window. The game scales based on this. So, if you set it as 640x480, then at this size the zoom level will be 1.0, but at 320x240 the zoom level will be 0.5, etc.
- Maintain Aspect Ratio, which keeps the square tile shapes if set to true. Otherwise it will set the tile size based on the size of the game window (stretchiness). True recommended.
Basically lets the player choose how big to play their game in. If done right they can even use F12 to play a browser game in full screen.
Dependencies
This is a complimentary plugin to Fit to Browser Window and doesn't make much sense without it:
https://forums.rpgmakerweb.com/index.ph ... dow.75199/
Further, it requires the plugin MBS - Map Zoom:
https://forums.rpgmakerweb.com/index.ph ... oom.48267/
You will need to setup the MBS - Map Zoom plugin with "Reset on Map Change" as false.
Screenshots
Default size set to 640x480, shown in various different browser windows.
Script - Alpha
Code:
//=============================================================================
// ScaleMapToGameResolution.js
//=============================================================================
/*:
* @plugindesc Scale Map to Game Resolution, Alpha v 0.01
* @author Afar Build 2
*
* @param Default Width
* @desc Makes the game not go below this size. 0 = doesn't matter.
* Default: 640
* @default 640
*
* @param Default Height
* @desc Makes the game not go below this size. 0 = doesn't matter.
* Default: 480
* @default 480
*
* @param Maintain Aspect Ratio
* @desc If this is set the tile size will be kept square. Otherwise the map will resize based on both vertices.
* Default: true
* @default true
*
*/
var AmyPond = AmyPond || {};
AmyPond.resolution = AmyPond.resolution || {};
AmyPond.parameters = PluginManager.parameters('ScaleMapToGameResolution');
AmyPond.defWidth = Number(AmyPond.parameters['Default Width'] || 640);
AmyPond.defHeight = Number(AmyPond.parameters['Default Height'] || 480);
AmyPond.maintainRatio = Number(AmyPond.parameters['Maintain Aspect Ratio'] || true);
AmyPond.gameMap_update = Game_Map.prototype.update;
Game_Map.prototype.update = function () {
var scale_x = (AmyPond.w / AmyPond.defWidth);
var scale_y = (AmyPond.h / AmyPond.defHeight);
if (AmyPond.maintainRatio == true) {
if (scale_y > scale_x) {
scale_x = scale_y;
} else {
scale_y = scale_x;
}
}
this._zoom = new PIXI.Point(scale_x, scale_y);
AmyPond.gameMap_update.call(this);
};
//=============================================================================
// End of File
//=============================================================================