Trampoline/bouncy spring, please help

ok to make a long story short, a few classmates and i are working on a school project, said project is a game. the game in question is a 2d side scrolling platformer

so far things are going rather well, we’ve got most of the code we think we need but mind you, we’re literal novices to this.

what is stumping us at the moment is how to create a “sonic esk spring” or a trampoline. esentaily we’re having the character jump on a auning and treat it like the sonic spring, propelling the character up into the air. the problem is we’re not able to find the code we need.

i’ve personaly tried searching the internet for trampoline scripts, spring scripts, ext, but it could be i’m just wording things wrong, or i dont know the lingo in the first place.

would anyone mind helping us find this script in question? we just need to have the character jump on the object and the character being propelled upwards. if anyone would be willing to help with this i’d be much apreciated. hell the class as a whole would be much apreciated.

I personally use this method:

var bounce : boolean = false;
var bounceAmount : float = 10;
var Player : Transform;

function OnCollisionEnter (other : Collision) {
	if(other.gameObject.tag == "Player") {
		bounce = true;
	}
}

function Update () {
	if(bounce) {
Player.rigidbody.velocity.y = 0;	Player.rigidbody.AddForce(0,bounceAmount,0,ForceMode.Impulse); 
bounce = false;
	}
}

It detects when the ‘Player’ (defined by you) enters the objects collider (aka hits it) then sends him into the air. Though this may not be the best way to handle it, it will work until someone with more experienced helps you.

You can also edit the amount they bounce up by simply changing the ‘bouceAmount’ variable. That is about it, if you got any questions just ask.

Works thanks!