x


Jump after picking up an object

I want to make a cube or something and when you step over it, it says "Press "P" to pick up superjump" and if you press "P" then the next time you press spacebar (my jump) you jump say five times higher, I know this is confusing but any help would be great thanks!

more ▼

asked Jun 25 '12 at 07:57 PM

Bruno Fludzinski gravatar image

Bruno Fludzinski
104 8 21 28

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Declare two var in your player's script, jumpForce = 5 and jumpForceBonus = 0. THe name and value aren't relevant, except the 0 and the logic behind. When you jump, you add a force Vector3.up * (jumpForce + jumpForceBonus) * Time.deltaTime.

Ok, now, when you pick the bonus, you can modify the jumpForceBonus value, which will allow you to do a super jump.

more ▼

answered Jun 25 '12 at 08:16 PM

Berenger gravatar image

Berenger
11k 12 19 53

can i have a script.

Jun 26 '12 at 03:32 PM Bruno Fludzinski
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x335
x140
x1

asked: Jun 25 '12 at 07:57 PM

Seen: 274 times

Last Updated: Jun 26 '12 at 03:32 PM