RPGMZ游戏引擎 如何手动控制文字显示速度

直接上代码

const _Window_Base_prototype_initialize = Window_Base.prototype.initialize;
	Window_Base.prototype.initialize = function(rect) {
		_Window_Base_prototype_initialize.call(this, rect);
		this.文字速度缓冲 = 0;
	};

this.文字速度缓冲 = 0; 进行缓冲 

Window_Base.prototype.processCharacter = function(textState) {
		this.文字速度缓冲 = this.文字速度缓冲 +0.1;
		if(this.文字速度缓冲>0.3){
			this.文字速度缓冲 = 0;
			const c = textState.text[textState.index++];
		
            if (c.charCodeAt(0) < 0x20) {
                this.flushTextState(textState);
                this.processControlCharacter(textState, c);
            } else {
                textState.buffer += c;
            }
		}
        
    };

this.文字速度缓冲 > 0.3 处理字符 速度可调整

这种方法适合不会写剧本的人使用 文字慢速显示 消耗玩家阅读时间 这样就可以弥补 剧情少的问题了

结尾总结

请Project1论坛的小圈子 离开

你可能感兴趣的:(游戏引擎,javascript,开发语言,RPGMZ)