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

9 years ago by davidg0

Help!

9 years ago by Joncom

I removed your other thread because it was a duplicate of this one.

What have you tried so far?
Do you already have a LevelExit entity JavaScript file?

More details please.

9 years ago by davidg0

Quote from Joncom
I removed your other thread because it was a duplicate of this one.

What have you tried so far?
Do you already have a LevelExit entity JavaScript file?

More details please.


Thanks.
I used the level-exit code in the biolob-entity-pack, here:
ig.module(
	'game.entities.levelchange'
)
.requires(
	'impact.entity'
)
.defines(function(){
	
EntityLevelchange = ig.Entity.extend({
	_wmDrawBox: true,
	_wmBoxColor: 'rgba(0, 0, 255, 0.7)',
	
	size: {x: 8, y: 8},
	level: null,
	
	triggeredBy: function( entity, trigger ) {	
		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] );
		}
	},
	
	update: function(){}
});

});

But this doesn't work!

9 years ago by Joncom

What do you mean "doesn't work"?
Do you encounter an error message?
Are you aware of how to view the JavaScript console to look for error messages?
Are you having trouble placing the entity within weltmeister?
How do you know it doesn't work?
Tell us what you see...

9 years ago by davidg0

Quote from Joncom
What do you mean "doesn't work"?
Do you encounter an error message?
Are you aware of how to view the JavaScript console to look for error messages?
Are you having trouble placing the entity within weltmeister?
How do you know it doesn't work?
Tell us what you see...

I added this code into an entity which can change the level when it's picked, but nothing happened( I've checked the console for many times but there's nothing )
How can I add a levelChange trigger like the one in Xibala? Thanks a lot. :)

9 years ago by nkurish

I'm attempting to do the same thing, and I am using the same level-exit code except I have changed .requires to use to the plugin.twopointfive.entity, instead.

ig.module(
	'game.entities.levelexit'
)
.requires(
	'plugins.twopointfive.entity'
	
)
.defines(function(){
	EntityLevelexit = tpf.Entity.extend({
		_wmDrawBox: true,
		_wmBoxColor: 'rgba(0, 0, 255, 0.7)',
		size: {x: 32, y: 32},
		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] );
				}
			}
		}

	});
});

The entity shows up and is placed in Weltmeister, and I have created the second level for the exit to go into. Additionally, I have already added the level-exit to the main.js requires block. The level-exit freezes my game when my player approaches it, but there are no issues in my console.
Page 1 of 1
« first « previous next › last »