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 ruimalta

I have created a new level level1.js and I have it declared in the main function on the .required as 'game.levels.level1', the Test Level was declared like 'game.levels.test' and in the init function I was calling it like the default as this.loadLevel( LevelTest );, but my problem is that when I try to load the level1, it won&039;t work, I tried #this.loadLevel( Levellevel1 );
What am I doing wrong?

1 decade ago by ruimalta

had to delete the level test on the main to load the new level, can&039;t I have two levels defined at the same time like #'game.levels.test' , it just don't work, I don't know why....

1 decade ago by dominic

this.loadLevel( LevelLevel1 ); – capital L in Level. Weltmeister automatically capitalizes the first letter of the level name, to be consistent with the CamelCase paradigm.

Also, check your browser&039;s console for error messages and use the console to test stuff - I.e. to find out if #LevelLevel1 is defined at all.

1 decade ago by ruimalta

somewhow I got it, but now, I want to change to the second level and I can't. I want to show the statistics before changing level and im calling a gameoverscreen like this:
GameOverScreen = ig.Game.extend({
instructText: new ig.Font('media/04b03.font.png'),
background: new ig.Image('media/black.png'),

init: function () {
ig.input.bind(ig.KEY.SPACE, 'start');

// sound.stop();
//this.stats = ig.finalStats;
},
update: function () {
var hero = this.getEntitiesByType( EntityHero )[0];

if(window.ourGame.lives == 0){ //if the gameover screen came because the hero lost
if (ig.input.pressed('start')) {
ig.system.setGame(StartScreen);
} }
if(window.ourGame.lives > 0){
if (ig.input.pressed('start')) {
this.loadLevel( LevelTwo );
}

And I can't change the level, either I'm trying to change the level like this or calling a function in another file called levelexit.js, that is:
nextLevel: function(){
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]);
}
}

how can I change the level?
Page 1 of 1
« first « previous next › last »