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 Manuel

Hi, i'm making a game jiji, and i just want to know how to make a countdown like fighting games like mortal kombat, street fighter.

Thanks

1 decade ago by Graphikos

ig.Timer

1 decade ago by Manuel

Can you explain a little bit more, i already read de docs but still i have no idea to how to make a countdown

Thanks

1 decade ago by Graphikos

Well I assume that the numbers for the countdown would be images. So you could do it with an entity and animation sheet and change the animation based on the timer. Have "3" be frame 1, "2" frame 2, "1" be frame 3, "Fight" be frame 4.

ig.module(
	'game.entities.countdown'
)
.requires(
	'impact.entity'
)
.defines(function(){

EntityCountdown = ig.Entity.extend({
	
	size: {x:48, y:48},
	collides: ig.Entity.COLLIDES.NONE,
	
	animSheet: new ig.AnimationSheet( 'media/coutdown.png', 48, 48 ),
	
	gravityFactor: 0,
	
	init: function( x, y, settings ) {
		this.parent( x, y, settings );
		
		this.addAnim( '3', 1, [1] );
		this.addAnim( '2', 1, [2] );
		this.addAnim( '1', 1, [3] );
		this.addAnim( 'Fight', 1, [4] );
		
		this.countdown = new ig.Timer(4);
	},
	
	update: function() {
		this.currentAnim = this.anims[Math.ceil(Math.abs(this.countdown.delta()))];
		this.parent();
	}
});

});

(mostly untested)
Page 1 of 1
« first « previous next › last »