- Joined
- Nov 13, 2018
- Messages
- 5
- Reaction score
- 0
- First Language
- Portuguese
- Primarily Uses
- RMMV
This is probably a super easy problem to solve, but I'm still a newbie at js so I don't know what to do.
I need a map event to make a sprite appear on the screen with a script call, like you would with a picture, but I'm not using those because for what I've seen they are not as dynamic and there is a limit to how many you can have on screen at the same time. I want to learn how to use sprites so I can try making HUD's and "bone" animations independent of the current scene.
One of the codes I tried was from this thread. I changed the scene from title to map to test it, so it looked exactly like this inside the script call:
but nothing appeared. I tried adding positions after this.addChild(sprite); with
but still, nothing appeared on screen.
Sorry if this is simple, I have difficulty learning stuff on my own and can't keep track of everything happening in the js files. So if anyone could send me the exact code I need to use just to show this white square it would be very appriciated.
EDIT: The kind Mr. Poryg provided the correct code for my case!
I need a map event to make a sprite appear on the screen with a script call, like you would with a picture, but I'm not using those because for what I've seen they are not as dynamic and there is a limit to how many you can have on screen at the same time. I want to learn how to use sprites so I can try making HUD's and "bone" animations independent of the current scene.
One of the codes I tried was from this thread. I changed the scene from title to map to test it, so it looked exactly like this inside the script call:
Code:
var aliasCreate = Scene_Map.prototype.create;
Scene_Map.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);
};
but nothing appeared. I tried adding positions after this.addChild(sprite); with
Code:
this.sprite.x = 0;
this.sprite.y = 0;
this.sprite.z = 2;
but still, nothing appeared on screen.
Sorry if this is simple, I have difficulty learning stuff on my own and can't keep track of everything happening in the js files. So if anyone could send me the exact code I need to use just to show this white square it would be very appriciated.
EDIT: The kind Mr. Poryg provided the correct code for my case!
Code:
var bitmap = new Bitmap(20, 20);
bitmap.fillAll('white');
var sprite = new Sprite(bitmap);
this._whiteSquare = sprite;
SceneManager._scene.addChild(sprite);
Last edited: