Adding Child in Manager classes not allowed?

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
So I went on making a simple image to be displayed when you invoke an action:

(function(){ BattleManager.invokeAction = function(subject, target) { this._logWindow.push('pushBaseLine'); if (Math.random() < this._action.itemCnt(target)) { this.invokeCounterAttack(subject, target); } else if (Math.random() < this._action.itemMrf(target)) { this.invokeMagicReflection(subject, target); } else { this.invokeNormalAction(subject, target); } subject.setLastTarget(target); this._logWindow.push('popBaseLine'); this.refreshStatus(); this.spAttack(); }; BattleManager.spAttack = function() { this.hiOugi = new Sprite(); this.updateSpAttack(); }; BattleManager.updateSpAttack = function(){ this.hiOugi.bitmap = ImageManager.loadPicture(this._subject.name); this.addChild(this._specialSkillAnimation); };})();  
But it says undefined is not a function on the this.addChild line. Is there a problem adding sprite images in BattleManager?
 
Last edited by a moderator:

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,949
Reaction score
3,042
First Language
French
Primarily Uses
RMMV
Simply because Battlemanager is a static classes and not a true classes

like it's was impossible to do this by calling a sprite in Ace you can't do that in MV too
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Simply because Battlemanager is a static classes and not a true classes

like it's was impossible to do this by calling a sprite in Ace you can't do that in MV too
In Ace's battle manager you can actually call a sprite as far as I remember.
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
564
Reaction score
275
First Language
German
Primarily Uses
Hi,

As far as I know, sprites can only be added to scenes (so they are drawn while the scene is active) or other sprites (drawn while the parent sprite is drawn). If you want a sprite to be displayed during battle, you should add it to the battle scene or the Spriteset_Battle instance.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
I see. I'll try to see what I can do because I want to determine which actor has used a skill and when it would be executed. I saw that the only way I could do this if I was into the invoking action for the skills, using of items, etc. I'll check Spriteset_Battle in this case.
 

DarknessFalls

Rpg Maker Jesus - JS Dev.
Veteran
Joined
Jun 7, 2013
Messages
1,393
Reaction score
210
First Language
English
this._specialSkillAnimationis never being set.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
BattleManager.updateSpAttack = function(){ this.hiOugi.bitmap = ImageManager.loadPicture(this._subject.name); this.addChild(this.hiOugi); };changed it to something like this, and addChild is still an undefined function.
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
Because BattleManager doesn't inherit from PIXI.DisplayObjectContainer, like Sprite and Scene do.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Because BattleManager doesn't inherit from PIXI.DisplayObjectContainer, like Sprite and Scene do.
Hmm, so where should I go, if I ever want to present a Sprite when an action is about to be executed? For example, Harold chooses Spark. Before Spark executes, I just want this sprite to show. Where can I find this specific action?
 

DarknessFalls

Rpg Maker Jesus - JS Dev.
Veteran
Joined
Jun 7, 2013
Messages
1,393
Reaction score
210
First Language
English
Why would you want the sprite to show before it is executed? 

In Game Action apply method you would say this.item().name === 'spark', call something like sprite.push or scene.push or something .push and push the object on.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,990
Members
137,562
Latest member
tamedeathman
Top