any news?
Text On Screen
JS Plugin RequestsThis is an old thread, but I'll do you a solid (hopefully I can get this up soon enough).
\
This just uses the game message, so you can put this thing in it.
Use like \[x:n y:n] for position only.
or
\[x:n y:n x2:n y2:n s:n] where x2 and y2 are the destination, and s is the speed.
From the GIF example...
the arguments/variables must be in that order because I'm not good with regex
This just uses the game message, so you can put this thing in it.
Use like \[x:n y:n] for position only.
or
\[x:n y:n x2:n y2:n s:n] where x2 and y2 are the destination, and s is the speed.
From the GIF example...
Code:
Ah! Moving text! \.\.
\[x:0 y:0 x2:100 y2:444 s:9]
the arguments/variables must be in that order because I'm not good with regex
PHP:
Bitmap.prototype._drawTextOdd = Bitmap.prototype._drawTextBody;
Bitmap.prototype._drawTextBody = function(text, tx, ty, maxWidth) {
if(text === "\x99"){
arguments[0] = "";
$gameMessage._isMoving = true;
}
this._drawTextOdd.apply(this, arguments);
};
Game_Map.prototype.updateOdd = Game_Map.prototype.update;
Game_Map.prototype.update = function(sceneActive) {
this.updateOdd.call(this, arguments);
if(
$gameMessage._isMoving !== undefined &&
$gameMessage._isMoving === true &&
$gameMessage._movement !== undefined &&
$gameMessage._movement.x2 !== false &&
$gameMessage._movement.y2 !== false &&
$gameMessage._movement.s !== false
){
var msg = SceneManager._scene._windowLayer.children[0];
var dst = $gameMessage._movement;
$gameMessage._isMoving = msg.x !== dst.x2 || msg.y !== dst.y2;
if($gameMessage._isMoving){
angle = Math.atan2(dst.y2 - msg.y, dst.x2 - msg.x);
var sX = dst.s * Math.cos(angle);
var sY = dst.s * Math.sin(angle);
msg.x = Math.abs(dst.x2 + sX) > Math.abs(msg.x + sX) ? msg.x + sX : dst.x2;
msg.y = Math.abs(dst.y2 + sY) > Math.abs(msg.y + sY) ? msg.y + sY : dst.y2;
}
}
};
Game_Message.prototype.clearOdd = Game_Message.prototype.clear;
Game_Message.prototype.clear = function() {
this.clearOdd.call(this, arguments);
this._isMoving = false;
this._movement = {
x: false,
y: false,
x2: false,
y2: false,
s: 5
};
};
Game_Message.prototype.add = function(text) {
var pe = this._movement || {};
text = text.replace(
/\\\[(x:(\d+?) y:(\d+?) ?)?(x2:(\d+?) y2:(\d+?) s:(\d+?))?\]/g,
function(m1, m2, x, y, m3, x2, y2, s){
pe.x = x !== undefined ? parseInt(x) : false;
pe.y = y !== undefined ? parseInt(y) : false;
pe.x2 = x2 !== undefined ?
parseInt(x2) : false;
pe.y2 = y2 !== undefined ?
parseInt(y2) : false;
pe.s = s !== undefined ? parseInt(s) : 5;
return "\x99";
});
this._texts.push(text);
};
Window_Message.prototype.updatePlacementOdd = Window_Message.prototype.updatePlacement;
Window_Message.prototype.updatePlacement = function() {
this.updatePlacementOdd.apply(this,arguments);
var pe = $gameMessage._movement || {};
if(pe.x !== false && pe.y !== false){
var msg = SceneManager._scene._windowLayer.children[0];
msg.x = pe.x;
msg.y = pe.y;
}
};
Original thread: https://forums.rpgmakerweb.com/threads/text-on-screen.52501/