Everything has been going smooth using Impact except for one thing. I can't seem to figure out how to do a partial jump, just like in the Biolab Disaster demo. Any ideas on a simple way to pull this off? I'm pretty good at javaScript, but I'm guessing I missed something very simple here.			
		 
			
			
			
				here's a way to do a mario-style jump (i.e tap jump softly for a normal jump, hold the key for a higher jump )
	init: function( x, y, settings ) {
		this.parent( x, y, settings );
		
		// Add the animations
		
                // jump timers
		this.jumpTimer = new ig.Timer();
		this.jumpAttackVel = -35;
		this.jumpSustainVel = -150;		
	},	
		// implement a mario based jump
 	    if( ig.input.pressed('jump') && this.standing) {
	      	this.jumpTimer.set(0);
			this.vel.y = this.jumpAttackVel;
		  
		} else if ( ig.input.state('jump') && this.jumpTimer.delta() < 0.25 ) {
	      	this.vel.y = this.jumpSustainVel;;
	    } else {
			this.accel.y = 0;
		}
			 
			
			
				1 decade ago 
				by MikeH
				
																
			
			
				I wrote a very simple way of doing it that doesn't use timers.
                // standing on the ground, jump is being pressed, and we're not already
                // moving up.
		if( this.standing && ig.input.state('jump') ) {
			if (this.vel.y == 0){
				this.vel.y = -this.jump;
				this.falling = false;
			}
		}else 
                // we're not standing, jump has been released and we're not falling
                // we reduce the y velocity by 66% and mark us as falling
                if(!this.standing && !ig.input.state('jump') && !this.falling) {
			this.vel.y = Math.floor(this.vel.y/3);
			this.falling = true;
		}
			 
			
			
			
				Thank you guys for the help, this will help a lot.
Just wanted to add that the first example provided makes the jumps very spacey (like Mario). While the MikeH's example feels more life like. Would be awesome if your examples could be placed in the docs.
Might have to try and figure out how to integrate the first method without timers. Afraid of bloating code for mobile with them.			
		 
	
	
	Page 1 of 1	
					« first
				
					« previous
				
					next ›
				
					last »