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 DesignByNumbers

I'm very new to Impact (and JavaScript), though I'm a competent C programmer. I've been following along with "Introducing HTML5 Game Development". I made some tiles and made a level with Weltmeister called "stars.js".

I'm running MAMP on a Mac, so I had to change the permissions on

/Applications/MAMP/htdocs/taylorturret/lib/game/levels

in order to save (taylorturret is the name of my game: I renamed the default Impact dir to that following the instructions in "Introducing...". No problem so far, saves and loads the level.

Then I tried modifying

/Applications/MAMP/htdocs/taylorturret/lib/game/main.js

to load the new level. I ended up with


ig.module( 
	'game.main' 
)
.requires(
    'impact.game',
    'game.levels.stars'
)
.defines(function(){

MyGame = ig.Game.extend({
	
	// Load a font
	//font: new ig.Font( 'media/04b03.font.png' ),
	
	
	init: function() {
	    // Initialize your game here; bind keys etc.
	    this.loadLevel( LevelStars ); 

	},
	
	update: function() {
		// Update all entities and backgroundMaps
		this.parent();
		
		// Add your own, additional update code here
	},
	
	draw: function() {
	    // Draw all entities and backgroundMaps
	    this.parent();
		
	    // Add your own drawing code here

	    //var x = ig.system.width/2, 
	    //y = ig.system.height/2; 
	    //this.font.draw( 'It Works!', x, y, ig.Font.ALIGN.CENTER );

	}
});


// Start the Game with 60fps, a resolution of 320x240, scaled
// up by a factor of 2
ig.main( '#canvas', MyGame, 60, 320, 240, 2 );

});


Here's the directory structure where I've got the level:

/><br />
<br />
and I'm getting the JavaScript console error:<br />
<br />
<pre>
Uncaught Unresolved (circular?) dependencies. Most likely there's a name/path mismatch for one of the listed modules:
game.main (requires: game.levels.stars)
</pre><br />
FWIW, here's what the level looks like <br />
<br />
<pre class= ig.module( 'game.levels.stars' ) .requires( 'impact.image' ) .defines(function(){ LevelStars=/*JSON[*/{"entities":[],"layer":[{"name":"main","width":30,"height":20,"linkWithCollision":false,"visible":1,"tilesetName":"media/StarTileset.png","repeat":false,"preRender":false,"distance":"1","tilesize":32,"foreground":false,"data":[[8,34,22,25,20,11,33,36,8,2,9,0,12,25,35,10,9,9,20,11,25,35,11,13,22,12,19,12,35,33],[20,22,10,22,23,26,10,8,20,24,7,17,11,11,7,5,1,30,9,5,17,36,30,13,35,34,34,22,23,20],[1,35,17,5,21,14,10,1,34,22,34,7,1,13,10,15,33,7,8,35,1,9,34,5,9,15,20,7,14,8],[25,22,6,1,8,12,2,11,2,34,20,8,18,10,26,34,34,6,20,7,9,18,33,5,12,36,2,26,18,34],[20,7,19,13,18,15,18,35,18,6,26,16,36,18,12,20,24,15,24,26,19,14,15,8,22,1,13,7,6,19],[26,7,10,33,9,35,30,5,24,15,35,1,8,34,1,1,8,35,12,2,1,7,14,13,21,24,36,22,13,17],[5,34,15,11,19,13,35,22,22,15,1,11,5,34,25,34,15,22,34,8,18,8,7,35,1,8,34,16,22,26],[9,17,6,2,15,26,17,7,34,8,18,7,22,12,15,19,34,22,26,25,1,13,20,20,15,8,8,18,15,7],[6,16,20,26,22,23,1,35,1,1,17,19,22,1,22,22,7,35,2,34,34,22,34,6,7,19,26,15,5,25],[1,9,33,9,8,8,19,34,9,13,16,15,10,8,34,22,10,1,22,9,20,17,23,33,1,2,20,1,11,8],[15,33,15,12,12,10,22,34,34,22,30,17,1,22,9,18,15,1,26,11,33,8,24,20,19,9,30,7,9,15],[7,18,13,24,35,6,34,7,5,14,7,6,6,13,15,20,15,30,5,19,22,7,18,34,34,22,35,15,33,13],[1,8,6,22,30,30,1,2,1,20,18,22,7,36,7,7,12,13,21,33,7,34,17,7,13,13,1,23,34,35],[19,20,9,9,15,12,6,26,26,11,9,19,30,24,22,5,8,20,18,15,8,7,35,1,18,34,7,6,8,22],[17,22,10,13,35,34,26,10,16,18,15,12,12,2,9,23,34,12,17,24,25,23,18,22,35,1,22,34,17,36],[33,34,20,34,34,11,25,34,20,18,1,22,30,20,6,7,1,22,26,23,7,15,34,8,8,22,18,21,13,20],[18,1,7,9,22,36,21,1,15,2,11,16,22,1,34,34,7,20,19,17,1,33,12,30,16,2,15,6,35,18],[9,6,15,6,8,18,22,20,7,35,30,26,34,1,10,24,25,14,1,13,15,6,22,9,18,20,34,1,8,34],[7,20,2,16,22,35,25,34,34,6,8,23,11,22,8,8,17,34,36,20,15,26,20,15,13,34,7,20,24,33],[20,34,8,23,8,14,17,2,2,22,12,13,17,20,36,6,2,35,22,25,9,22,10,23,33,8,10,9,18,18]]}]}/*]JSON*/; LevelStarsResources=[new ig.Image('media/StarTileset.png')]; });
The symptom is that nothing loads: no new level, no nothing. Any thoughts? Thanks for the help!

1 decade ago by DesignByNumbers

Huh. Update: I restarted the machine and everything shows up as expected. I'll leave this here in case it's some kind of reproducible bug. On to the next problem!

1 decade ago by mtg101

I find I have to clear my browser's cache quite a lot when developing, otherwise some files don't get reloaded, but some do, and all sorts of weird errors like this start appearing.

1 decade ago by fulvio

Yeah, what mtg101 said. Clear your browser cache if you find any abnormalities with code not loading for the first time. This also applies to any updated images as well.

1 decade ago by drhayes

Shameless plug!

I found working with MAMP on my Impact game to be a big pain. Caching files, modifying .htaccess, etc... so I molded an open source HTTP server in NodeJS to work with Impact.

See if it treats you better. Let me know if you use it and have questions.

1 decade ago by DesignByNumbers

Thank you all! @drhayes, I haven't tried your server yet, but I'll post if I do. I'm finding that clearing the cache does help with this.
Page 1 of 1
« first « previous next › last »