Positioning enemies in the battle screen before battle starts

ze1

Veteran
Veteran
Joined
Apr 19, 2012
Messages
32
Reaction score
4
Primarily Uses
I'm trying to make it so that enemies X and Y positions are calculated right before the battle starts. I need this because the enemy amount and positioning are determined before the battle starts, and not by using the Troop tab in the game database.
The problem is that to position enemies, I need to know their bitmap's width and height dimensions, which I can't figure out how to do thanks to how RMMV works (with async loading and all).
So, what I want to do is something like this:
1) a battle is triggered, screen fades out
2) during the transition, the game decides which and how many enemies are going to fight (this much I can do)
3) position the enemies in the battle scene (I can't do this because I don't know the bitmap dimensions...)
4) battle scene fades in

Any idea on how to do this?

----

I also considered getting all the enemies' sprites width and height before the game started and storing that info in the $dataEnemies array, but I have a similar problem as above...

I got this function here, which tries to save the bitmap width info in the enemy data


Code:
ZNT_Scene_Boot_start = Scene_Boot.prototype.start;



Scene_Boot.prototype.start = function() {

saveWidth = function(bitmap, _i) {

$dataEnemies[_i].bitmapWidth = bitmap.width

alert(" ok " + _i + " " + $dataEnemies[_i].name + " > " + $dataEnemies[_i].bitmapWidth)

}

for (var i=0; i<$dataEnemies.length;i++){

var enemy = $dataEnemies;

if (!enemy)

continue;

var bitmap = ImageManager.loadEnemy(enemy.battlerName, 0);

bitmap.addLoadListener(saveWidth.bind(this, bitmap, i))

}



ZNT_Scene_Boot_start.call(this);

};
But the problem is that when I'm trying to test a battle from the database, the info isn't available soon enough. I need it before the Game_Troop.setup function is called, but that doesn't happen.
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Got inspired and started writing a simple tower defence battle system last night :o
Good news! I have located an amazing 3D website called SketchFab that has rotatable renderings of famous statues!
Picked up a physical copy of Megadimension Neptunia VII for the PS4 today. It's pretty good. I'm having a lot of fun with it.
The only upside of this remote semester was the plenty of funny photoshop material those facecams provided. Not that I would do that. Ever.

Forum statistics

Threads
100,516
Messages
976,707
Members
132,080
Latest member
nwr
Top