Hi,
I want to draw sprite through code, I don't want to use the existing pitcure system for what I need to do, I want to create a class of my own which you can pass a bitmap to and get it drawn on screen. Maybe there is alredy a class for that but a big part of the code is hidden in MV and i didn't find any in the .js i looked through. The only usefull thing I found is the "Bitmap" class in the "rpg_core.js" file but it doesn't seem to have a draw() call.
Thank you 🙂
I can't find scene in the Developer Tool .-.
Could you please like write how for examaple draw a white 20x20 square in the scene?
Something like:
var bitmap = new Bitmap(20, 20);bitmap.fillAll('white');var sprite = new Sprite(bitmap);(scene?).addChild(sprite);Edit: I guess with scene you mean like Scene_Map or something like that, but since I didn't find the addChild() function i guess this class is instatiated with another name, but I can't find it either if that's the case
You are usually inside the scene, when adding sprite.
So, for example, if you want to add said white square to the title screen, you would do it like this:
var aliasCreate = Scene_Title.prototype.create;Scene_Title.prototype.create = function() { aliasCreate.call(this); var bitmap = new Bitmap(20, 20); bitmap.fillAll('white'); var sprite = new Sprite(bitmap); this._whiteSquare = sprite; this.addChild(sprite);};Note, that i also added the sprite to the scene under the name "_whiteSquare". This way it's easier to reference it if you want, for example, to move it to a different position at some point./edit, in case you are wondering: What i've done above is that i've aliased the "create" function of the "Scene_Title" class. Every function in Javascript is an object in memory, which automatically gets destroyed, once it's not referenced anymore.
So, i added a new reference to the function (first line), before overwriting it (second line). This way, the old function still exists and i can call it from the new one. This allows me to add to the original function, instead of completely overwriting it.
Ok thank you very much!!
Don't want to insist too much but do you have any idea how to do this through command line? I think I could have more fexibility having also that option 😛
Nice I got it it worked! thank you very much, I really couldn't find the current scene placeholder