- Joined
- Jan 11, 2014
- Messages
- 624
- Reaction score
- 159
- First Language
- English
- Primarily Uses
- RMMZ
I have this plugin to display a picture that represents the actor's current TP. For instance, every 10 TP the player has, 1 "dot" is drawn, up to 8 dots (80TP).
However, after 1 turn in battle, it begins to lag at an exponential rate. I am guessing that it is because of the rate the game is drawing the images.
I am not fluent in JavaScript, only have learned some things from what I see in other plugins.
Here is a portion of code:
Tp_bar_dot = new Sprite_Base(); if(b1rate == 0.8){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots8");} else if(b1rate >= 0.7){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots7");} else if(b1rate >= 0.6){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots6");} else if(b1rate >= 0.5){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots5");} else if(b1rate >= 0.4){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots4");} else if(b1rate >= 0.3){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots3");} else if(b1rate >= 0.2){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots2");} else if(b1rate >= 0.1){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots1");} this.removeChild(Tp_bar_dot); this.addChild(Tp_bar_dot);This is in the function in a usermade script that draws a separate TP bar based on Actor1's TP. It is called everytime Window_Base.update is called.
Is there a way I can do this without causing lag? I can post the entire code if need be.
However, after 1 turn in battle, it begins to lag at an exponential rate. I am guessing that it is because of the rate the game is drawing the images.
I am not fluent in JavaScript, only have learned some things from what I see in other plugins.
Here is a portion of code:
Tp_bar_dot = new Sprite_Base(); if(b1rate == 0.8){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots8");} else if(b1rate >= 0.7){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots7");} else if(b1rate >= 0.6){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots6");} else if(b1rate >= 0.5){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots5");} else if(b1rate >= 0.4){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots4");} else if(b1rate >= 0.3){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots3");} else if(b1rate >= 0.2){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots2");} else if(b1rate >= 0.1){ Tp_bar_dot = new Sprite_Base(); Tp_bar_dot.bitmap = ImageManager.loadPicture("tpdots1");} this.removeChild(Tp_bar_dot); this.addChild(Tp_bar_dot);This is in the function in a usermade script that draws a separate TP bar based on Actor1's TP. It is called everytime Window_Base.update is called.
Is there a way I can do this without causing lag? I can post the entire code if need be.

