1 decade ago by PabloAM
Hello everyone.
I´m having a problem with spawnEntity and how spawn Entities from a class.
The thing is that I have a Class named "Life" and I want to do a generic class called "TextInfo".
The purpose is do a spawnEntity of TextInfo from Life with a text wrote.
If I write the code in the same file works.
If I create a InfoText.js doesn´t works.
Which could be the problem?
The code (brief):
I´m having a problem with spawnEntity and how spawn Entities from a class.
The thing is that I have a Class named "Life" and I want to do a generic class called "TextInfo".
The purpose is do a spawnEntity of TextInfo from Life with a text wrote.
If I write the code in the same file works.
If I create a InfoText.js doesn´t works.
Which could be the problem?
The code (brief):
/////////////////////// Life.js: ///////////////////////////// check: function( other ) { if (other instanceof EntityPlayer && !this.touched) { this.lifeUpSFX.play(); ig.game.lives ++; ig.game.spawnEntity( EntityInfoText ,this.pos.x, this.pos.y ); } //////////////////////// InfoText.js: ////////////////////////// ig.module( 'game.entities.InfoText' ) .requires( 'impact.entity' ) .defines(function(){ EntityInfoText = ig.Entity.extend({ //MY CODEEE... });