two different movements at the same time

hey everyone, I am working on a project where my character runs around a round circle like a planet, think something like a 2d mario galaxy. I have the character always accelerating at the center of the planet, and I have his rotation constrained to the angle he is at to the planet so he is always on his feet.

Here is my problem. I have the character able to run both directions and jump. However if I jump and am holding the button to move sideways my character will not move down since the acceleration is overridden by the command to move sideways.
Not sure how to fix this, I can't use linear velocity since my character is moving around a circle, wish that you could have accelerate and movement both happen at the same time...

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    I'd simply interpolate the actor up and down for the jump . . . .

  • SocksSocks London, UK.Member Posts: 12,822

    Example:

  • SocksSocks London, UK.Member Posts: 12,822

  • thanks @socks however do you have any thoughts on controlling the left and right movement outside of the physics. Reason being the more complicated stuff is going to be the up and down, I plan on double jumps and enemies hitting you into the air at different velocities and gravity pulling you back, maybe even multiple hits in the air.

    I'm wondering if there is a way to figure out the x,y coordinates to the left and right of you depending on the angle and changing your position to those over and over again or something like that

  • p.s. love the second video

  • SocksSocks London, UK.Member Posts: 12,822

    @RossmanBrothersGames said:
    I'm wondering if there is a way to figure out the x,y coordinates to the left and right of you depending on the angle and changing your position to those over and over again or something like that

    I don't know what that means.

  • I figured it out using the COS and SIN to add or subtract to the x and y position over and over when you hold the right and left buttons down, but it was too choppy, I think I will need to make it work with your method, thanks for all the help!

  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2015

    @RossmanBrothersGames said:
    I figured it out using the COS and SIN to add or subtract to the x and y position over and over when you hold the right and left buttons down, but it was too choppy . . .

    You can constrain the object to the cos and sin of an angle instead, which will be very smooth.

    Constrain X position to radius * cos (angle) + X pivot point
    Constrain Y position to radius * sin (angle) + Y pivot point

    . . . and just have the left and right keys change the angle.

  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2015

    Example file attached:

    Space bar = jump
    Left Arrow = CCW
    Right Arrow = CW

  • vectorstudiovectorstudio Member Posts: 50

    wonderful!!

    @Socks said:
    Example:

  • PhilipCCPhilipCC Encounter Bay, South AustraliaMember Posts: 1,390

    @Socks These are brilliant! :o

  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2015

    @PhilipCC said:
    Socks These are brilliant! :o

    Weird !? :smile: I'm always surprised at what people are taken by, you spend hours fiddling around with some way to get the actor to change its colour based on the current Euro to Dollar exchange rate using the phase of the moon and wind speed in the North Atlantic to modify the rate of updates . . . and you get a 'meh' . . . but move an actor in a circle and people are amazed ! Lol :smiley:

  • PhilipCCPhilipCC Encounter Bay, South AustraliaMember Posts: 1,390

    @Socks said:
    Weird !? :smile: I'm always surprised at what people are taken by, you spend hours fiddling around with some way to get the actor to change its colour based on the current Euro to Dollar exchange rate using the phase of the moon and wind speed in the North Atlantic to modify the rate of updates . . . and you get a 'meh' . . . but move an actor in a circle and people are amazed ! Lol :smiley:

    You under-rate your prowess, good sir. Anything that I don't know how to implement so elegantly in GS amazes me, especially when it triggers an idea in my mind about a whole game based on one short tutorial.

    As I have mentioned elsewhere in the forum, the core group of long-standing Pro Members like yourself, who contribute so generously with code and tutorials to further our skills, are greatly appreciated. :)

Sign In or Register to comment.