Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by auz1111

Soooo...

I have made sure the class is required in main.js, I have named the entity file endlevel.js, and I am initiating the class such as:

EntityEndlevel = ig.Entity.extend({ });

I recieve this error in Weltmeister when trying to bring the entity into the level.

The following entity classes were not loaded due to
file and class name mismatches: 

lib/game/entities/endlevel.js (expected name: EntityEndlevel)

Any ideas or way I can debug this? All the names are spelled correctly. I am very new at this and not seeing the problem...

1 decade ago by paulh

is


ig.module(
    'game.entities.endlevel'
)

1 decade ago by auz1111

This is exactly what I have:

ig.module(
	'game.entities.endlevel'
)
.requires(
	'impact.entity'
)
.defines(function(){
	EntityEndlevel = ig.Entity.extend({
		
		_wmDrawBox: true,
		_wmBoxColor: 'rgba(0, 0, 255, 0.7)', 
		size: {x: 8, y: 8},
		
		level: null,
		
		checkAgainst: ig.Entity.Type.A,
		
		update: function(){},
		
		check: function( other){
			if(other instanceof EntityPlayer){ 
				if( this.level ) { 
					var levelName = this.level.replace(/^(Level)?(\w)(\w*)/, function( m, l, a, b ) { 
						return a.toUpperCase() + b; 
					}); 
					ig.game.loadLevelDeferred( ig.global['Level'+levelName] ); 
				} 
			}
		}
		
		
		
	});
	
	
});

Thanks for your time!

1 decade ago by auz1111

After using the javascript console in chrome it looks like this line is causing the issue:

checkAgainst: ig.Entity.Type.A,

If I delete it the error goes away. Now to figure out why...

1 decade ago by paulh

prob needs a

type: ig.Entity.TYPE.B,

if it has a checkagainst?

1 decade ago by auz1111

It should be checking against collision for TYPEA entity... I have the type for the player set.

type: ig.Entity.TYPE.A,

Hmmmm....

1 decade ago by auz1111

I'm getting the script straight from the HTML 5 Development book...

Here is the javascript console error.

Uncaught TypeError: Cannot read property 'A' of undefined

1 decade ago by auz1111

Ahhhhh.... got it.


Yeah have to put in this stuff, too.

//Collision detection
		type: ig.Entity.TYPE.B,
		checkAgainst: ig.Entity.TYPE.A,
		collides: ig.Entity.COLLIDES.PASSIVE,

1 decade ago by auz1111

You did tell me that paul, but I also had to put in the collides property, as well.

Thank you!
Page 1 of 1
« first « previous next › last »