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 riceje7

I am using this button plugin ( ButtonPlugin) to render some buttons on my splash screen which is defined here:

ig.module('game.main').requires('impact.game', 'impact.font', 'impact.image', 'plugins.Button', 'plugins.PersistantData', 'plugins.impact-splash-loader').defines(function () {
	SplashScreen = ig.Game.extend({
		bgImage: new ig.Image("media/splashscreen_bg.png"),
		titlefont: new ig.Font("media/titlefont.font.png"),
		buttons: new Array(6),
		buttonsData: {
			ylocs: [832, 960, 1792, 1920, 2752, 2880],
			w: 128,
			h: 85
		},
		navbutton: new ig.AnimationSheet("media/navbutton.png", 128, 85),
		init: function () {
			for (var i = 0; i < this.buttons.length; i++) {
				var button = ig.game.spawnEntity(Button, this.buttonsData.ylocs[i], 64, {
					flip: i % 2 === 0 ? false : true,
					animSheet: this.navbutton,
					size: {
						x: this.buttonsData.w,
						y: this.buttonsData.h
					},
					pressedUp: function () {

					}
				});
				this.buttons.push(button);
			}
		},
		update: function () {
			this.parent();
		},
		draw: function () {
			this.parent();
			this.bgImage.draw(0, 0);
		}
	});


	// Start the Game with 60fps, a resolution of 320x240, scaled
	// up by a factor of 2
	ig.main('#canvas', SplashScreen, 60, 960, 640, 1, ig.ImpactSplashLoader);

});	

I am also using Dom's animated splash loader screen.
However the loader stalls and freezes once it's almost finished, without throwing any errors or giving me any indication as to whats going wrong. I'm pretty sure it has something to do with trying to load the resource media/navbutton.png because under the network tab in chrome it always shows that file as pending. I know that the permissions for the file are correct because it is the same as the other images im loading and they load fine. So i'm convinced there's something wrong with my code that i'm not seeing. any help would be greatly appreciated. Thanks!

UPDATE: I've been fiddling with the code and just noticed that the image file is being loaded all the way, as shown in the network monitor in chrome. But the impact loading screen is still freezing up. i'll keep at it.

UPDATE 2:
I removed the code where i was adding the spawned button entity to an array and rewrote it and all is well now, well sort of i have new problems but unrelated and i should be able to work my way through them pretty easily. thanks again

1 decade ago by isaac

I can't tell what is happening since this is only part of the whole thing, but (i % 2 === 0) ?
:)
Page 1 of 1
« first « previous next › last »