Can't seem to clone a bitmap

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
424
Reaction score
171
First Language
Dutch
Primarily Uses
RMMV
function cloneObject(x){    return Object.create( x ); // still doesn't work...// return Object.assign({}, x); // does not work...// Afaik JQuery is not supported in RPG Maker so all those solutions are a no-go anyway.};I also found this:

Object.extend = function(destination, source) { for (var property in source) destination[property] = source[property]; return destination;};// ERROR: caller, callee and arguments may not be accessed on strict mode.Object.deepExtend = function(destination, source) {  for (var property in source) {    if (typeof source[property] === "object" &&     source[property] !== null ) {      destination[property] = destination[property] || {};      arguments.callee(destination[property], source[property]);    } else {      destination[property] = source[property];    }  }  return destination;};// ERROR: caller, callee and arguments may not be accessed on strict mode.But that one throws an error when writing in strict mode...

How can I clone a bitmap...
 
Last edited by a moderator:

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
424
Reaction score
171
First Language
Dutch
Primarily Uses
RMMV
Maybe the problem is that the window is created multiple times without being destroyed. But removing a window from the Scene's children and deleting all references to it should remove it from memory right?
Also, is there a way to get all the references to a window to make sure there isn't something referencing it?
I kinda miss the dispose()...

Okay after some more testing, there is only 1 window instance active. And after some more testing I found out that the cloning is the problem (because a new Bitmap(1000,1000) does work, but cloning not). How do I clone a bitmap..

Oh well. I'll just blt() the original map onto a new bitmap object because that seems to work and I don't need to copy most properties anyway.
 
Last edited by a moderator:

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
Depending on what you want to do, you could create a PIXI.RenderTexture, render the bitmap's baseTexture on it and use that to create a new sprite. I don't have a working example ready, but it should work.
 

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

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,070
Members
137,577
Latest member
SadaSoda
Top