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 jch02140

I tried playaround the ImpactJS and using the provided game sample Jump 'n' Run to add a level with some custom tiles. Everything seems to work but...

/><br />
<br />
Is there a way to make it so that the game is zoom in without seeing multiple rows of the background?<br />
<br />
Also, is it possible to do it on  a per map basis?<br />
<br />
Thanks			</div>
		</div>
			<div class=

1 decade ago by FragOnly

Hello,

If you go to the background layer and uncheck "Repeat" you can manually paint the background in where you would like it. Even on a per map basis.

1 decade ago by jch02140

Hi,

I have unchecked the repeat option for the background layers but showing empty in the negative axis area...

/>			</div>
		</div>
			<div class=

1 decade ago by Joncom

Is there a way to make it so that the game is zoom in without seeing multiple rows of the background?
I don't understand the question. Are you saying you want the background to repeat along x, but not along y?

1 decade ago by jch02140

Yes... Sorry for the confusion...

Also, is there a way to make the map enlarge so that the empty area are not shown?

1 decade ago by Joncom

a way to make the map enlarge
Try increasing the game scale when you call ig.main().

http://impactjs.com/documentation/class-reference/game

And as for repeating the background map along only the x-axis, the easiest solution might be to make the background tall enough that the user simply doesn't see the vertical repetition.

1 decade ago by jch02140

I tried to stretch the background but it doesn't work...

I tried to use another sample and replace the default level with my test map and here is what is shown in the game.

/><br />
<br />
I have repeat background enabled... and in this sample it doesn't goes over the game's bounding box... So it seems to be something in the main.js in the previous example that overide the default settings of ImpactJS.... but I have no idea what it is...			</div>
		</div>
			<div class=

1 decade ago by jch02140

I think I found out the code which causes the display issue if I am using a tile set size that are not specifically 70x70px...


// If our screen is smaller than 640px in width (that's CSS pixels), we scale the 
// internal resolution of the canvas by 2. This gives us a larger viewport and
// also essentially enables retina resolution on the iPhone and other devices 
// with small screens.
var scale = (window.innerWidth < 640) ? 2 : 1;


// We want to run the game in "fullscreen", so let's use the window's size
// directly as the canvas' style size.
var canvas = document.getElementById('canvas');
canvas.style.width = window.innerWidth + 'px';
canvas.style.height = window.innerHeight + 'px';


// Listen to the window's 'resize' event and set the canvas' size each time
// it changes.
window.addEventListener('resize', function(){
	// If the game hasn't started yet, there's nothing to do here
	if( !ig.system ) { return; }
	
	// Resize the canvas style and tell Impact to resize the canvas itself;
	canvas.style.width = window.innerWidth + 'px';
	canvas.style.height = window.innerHeight + 'px';
	ig.system.resize( window.innerWidth * scale, window.innerHeight * scale );
	
	// Re-center the camera - it's dependent on the screen size.
	if( ig.game && ig.game.setupCamera ) {
		ig.game.setupCamera();
	}
	
	// Also reposition the touch buttons, if we have any
	if( window.myTouchButtons ) {
		window.myTouchButtons.align(); 
	}
}, false);


// Finally, start the game into MyTitle and use the ImpactSplashLoader plugin 
// as our loading screen
var width = window.innerWidth * scale,
	height = window.innerHeight * scale;
ig.main( '#canvas', MyTitle, 60, width, height, 1, ig.ImpactSplashLoader );

});

When I try to comment out the code above (beside the ig.main and substitute the width and height variables to arbitrary number like 640 and 480 respectively. The game would not load....
Page 1 of 1
« first « previous next › last »