Author Topic: Help with the math  (Read 1406 times)

caladan21ph

  • Member
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile
Help with the math
« on: Fri, Jan 20, 2012 »
Okay, so I'm making a small game wherein the player jumps between small platforms. In the game, the player jumps automatically when no buttons are currently pressed. What I want to happen in the game is to make the player jump in arc from one platform to the next.Basically all I need is help to create the animation of the player jumping from one platform to the next automatically. How do I do this(if there is math involved please share). Thanks!
Check out my game journal: http://alternatdev.wordpress.com

John Hutchinson (Johntron247)

  • Commodore 256
  • Contributor
  • ****
  • Posts: 392
  • Karma: +1/-0
  • I can has lazerz?
    • View Profile
    • Level X Games
Re: Help with the math
« Reply #1 on: Fri, Jan 20, 2012 »
I get that you want the player to automatically jump to the next platform but exactly how that happens isn't clear.  Can you draw it out or explain it in more detail?  Is there a specific reason you're staying away from the usual gravity (+accel.y) and jump (-vel.y) system?

It appears that you already know how to make a character jump: http://alternatdev.wordpress.com/2011/12/01/post-mortem-the-adaptor/  so that's why I'm asking what's different about your current idea

btw, the link in your signature is broken
« Last Edit: Fri, Jan 20, 2012 by JohnTron247 »

caladan21ph

  • Member
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile
Re: Help with the math
« Reply #2 on: Fri, Jan 20, 2012 »
Well the main difference is that game won't be using the directional buttons. The player will just automatically jump to the platform nearest to him. The platforms will be coming from the top of the screen and then descend. I just need to know how to make an object travel in arc from the current platform he is stepping on to another platform. I'll make a pic then post in.
Its for the experimental gameplay project for this month. The controls will be sensors that the player will be stepping on. If a player is not stepping on a sensor it means that he's jumping from one platform.Something like that.
« Last Edit: Fri, Jan 20, 2012 by caladan21ph »
Check out my game journal: http://alternatdev.wordpress.com

test84

  • Key Contributor
  • *****
  • Posts: 1328
  • Karma: +0/-0
  • ت
    • View Profile
    • My personal site.
Re: Help with the math
« Reply #3 on: Fri, Jan 20, 2012 »
For curvy movement I use Greensock's TweenMax, for example look at this:
TweenMax.to(this, 1.5, { bezier: [ {x:"64", y:"-64"}, {x:"80", y:"200"} ], onComplete: removeSprite } );

You define a curve with control points and call back functions. Hope it's what you want.
(Head to their website, it has samples and interactive demos on this)
blog, twitter, Check out my award winning game, Rot Gut:

pixelomatic

  • Active Member
  • ***
  • Posts: 131
  • Karma: +0/-0
    • View Profile
Re: Help with the math
« Reply #4 on: Sat, Jan 21, 2012 »
I think he wants a system like assassin's creed and batman arkham city. I don't really know the math behind it, but you can somehow calculate the trajectory required to access some place, or use tweens like test84 said.

test84

  • Key Contributor
  • *****
  • Posts: 1328
  • Karma: +0/-0
  • ت
    • View Profile
    • My personal site.
Re: Help with the math
« Reply #5 on: Sat, Jan 21, 2012 »
I think he can put point(s) he want into that bezier spline.

Beware that using Greensock stuff in a commercial project requires paying a fee or so.
blog, twitter, Check out my award winning game, Rot Gut: