1 decade ago by ZYGERv2
Hello everyone,
I just got my hands on Impact yesterday and I've been playing around a bit. But now that I'm trying to set up a game I'm running into a little snag. This error comes up and nothing loads:
Here is what I have for the mentioned "screens":
mainmenu_screen.js
options_screen.js
When I remove 'game.screens.mainmenu_screen' from the requires area in options_screen.js everything loads up but the back button fails since the link to MainMenuScreen was removed. I need some help getting through this circular dependencies error, 'game.screens.mainmenu_screen' needs to be in the requires area so the back button can work. I've tried a few ideas but I'm lost now =P
I just got my hands on Impact yesterday and I've been playing around a bit. But now that I'm trying to set up a game I'm running into a little snag. This error comes up and nothing loads:
Uncaught Unresolved (circular?) dependencies. Most likely there's a name/path mismatch for one of the listed modules: game.main (requires: game.screens.mainmenu_screen) game.screens.mainmenu_screen (requires: game.screens.options_screen) game.screens.options_screen (requires: game.screens.mainmenu_screen)
Here is what I have for the mentioned "screens":
mainmenu_screen.js
ig.module('game.screens.mainmenu_screen')
.requires('impact.game', 'impact.font', 'impact.image',
'game.screens.game_screen', 'game.screens.options_screen')
.defines(function(){
var startButton = new ig.Image('media/button/startbutton.png');
var optionsButton = new ig.Image('media/button/optionsbutton.png');
MainMenuScreen = ig.Game.extend({
init: function() {
this.backgroundImage = new ig.Image('media/background/mainmenubackground.png');
ig.input.bind(ig.KEY.MOUSE1, 'select');
},
update: function() {
this.parent();
if(ig.input.pressed('select')){
if(ig.input.mouse.x >= 360 && ig.input.mouse.x <= 648){
if(ig.input.mouse.y >= 150 && ig.input.mouse.y <= 225){
ig.main( '#canvas', GameScreen, 60, 1024, 576, 1 );
}else if(ig.input.mouse.y >= 450 && ig.input.mouse.y <= 525){
ig.main( '#canvas', OptionsScreen, 60, 1024, 576, 1 );
}
}
}
},
draw: function() {
this.parent();
this.backgroundImage.draw(0,0);
startButton.draw(350,150);
optionsButton.draw(360, 450);
}
});
});
options_screen.js
ig.module('game.screens.options_screen')
.requires('impact.game', 'impact.font', 'impact.image', 'game.screens.mainmenu_screen')
.defines(function(){
var backButton = new ig.Image('media/button/back.png');
OptionsScreen = ig.Game.extend({
init: function() {
this.backgroundImage = new ig.Image('media/background/blankbackground.png');
ig.input.bind(ig.KEY.MOUSE1, 'select');
},
update: function() {
this.parent();
if(ig.input.pressed('select')){
if(ig.input.mouse.x >= 0 && ig.input.mouse.x <= 200){
if(ig.input.mouse.y >= 0 && ig.input.mouse.y <= 100){
ig.main( '#canvas', MainMenuScreen, 60, 1024, 576, 1 );
}
}
}
},
draw: function() {
this.parent();
this.backgroundImage.draw(0,0);
backButton.draw(0,0);
}
});
});
When I remove 'game.screens.mainmenu_screen' from the requires area in options_screen.js everything loads up but the back button fails since the link to MainMenuScreen was removed. I need some help getting through this circular dependencies error, 'game.screens.mainmenu_screen' needs to be in the requires area so the back button can work. I've tried a few ideas but I'm lost now =P
