I am using a plugin that I have made which is creating and drawing images where I need them. However when the character moves the images drag compared to the map. I believe this has to do with update order but I am uncertain how to restructure the code to fix that.
Code:
//Get relevant tiles from map data
function parseTileData() {
var tileWidth = $gameMap.tileWidth();
var tileHeight = $gameMap.tileHeight();
var iteration = 2;
var tone = [-68, -68, 0, 68];
var log = 0;
$gameScreen.clearPictures();
$gameScreen.showPicture(1, "_$Light 2", 2, (($gamePlayer._realX-$gameMap.displayX() - 8)*48)+Graphics.width/2, (($gamePlayer._realY-$gameMap.displayY() - 6)*48)+Graphics.height/2, 300, 300, 100, 1);
//console.log("gamePlayer.X: " + $gamePlayer._realX + " $gameMap.displayX(): " + $gameMap.displayX() + " $gameVariables.value(0003): " + $gameVariables.value(0003));
for(var y = Math.floor($gameMap.displayY())+5; y < Math.floor($gameMap.displayY())+15; y++) {
for (var x = Math.round($gameMap.displayX())-3; x < Math.round($gameMap.displayX())+17; x++) {
if ($gameMap.terrainTag(x, y) == 1) {
if(y == Math.floor($gameMap.displayY())+5 && $gameMap.displayY()-Math.floor($gameMap.displayY()) != 0)
{
$gameScreen.showPicture(iteration, "!$Light", 0, (x*48)-(($gameMap.displayX() * 48))+4, (y*48)-(($gameMap.displayY() * 48)), 100, 100, 255*(1+(Math.floor($gameMap.displayY())-$gameMap.displayY())), 0);
}
else
{
$gameScreen.showPicture(iteration, "!$Light", 0, (x*48)-(($gameMap.displayX() * 48))+4, (y*48)-(($gameMap.displayY() * 48)), 100, 100, 255, 0);
}
$gameScreen.tintPicture(iteration, tone, 0);
iteration++;
}
}
}
}