Actor catapult question

Hello GS community,

I have struck in a major issue in the process of developing my game.

I am struggling to create the following thing:

I have a circle which has the role of a catapult. A main actor who is affected by gravity. When main actor collides with the circle catapult it is "catapulted" in a direction, which is determined by the angle of the collision. After being catapulted, I would like the main actor to accelerate after that to decelerate, after collision with another circle to accelerate and decelerate and etc. How I can do that?

image

A simple illustration of what I would like to create.

The top of the trajectory is the end point of acceleration then the downwards trajectory to be the deceleration.

Thank you in advance.

Comments

  • BonepileGamesBonepileGames Member Posts: 194
    I forgot to say that the acceleration is determined by the power meter, which is triggered in the mid-air flying by holding the touch.
  • BonepileGamesBonepileGames Member Posts: 194
    Bumpy bump
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    First I would put a time limit on the accelerate behavior so it stops imputing velocity. You can also increase the drag as well. This is real physics so think about what affects an object in real life. Drag is the same as wind resistance and gravity is the same. When you throw a ball it has a peak velocity created by the throwing motion, energy in, as the energy decreases in it's effort to overcome the gravity and wind resistance it decelerates. If you keep the accelerate behavior going then it's more like a rocket engine than throwing something.
  • BonepileGamesBonepileGames Member Posts: 194
    @FlyingBaconStudios

    Actually, I am quite sure how to adjust the real-life physics into the main actor. The issue here is the way the main actor detects the collision angle with the catapult as it is circle. This will determine the exact direction of the acceleration of the actor. Any ideas how to inplement that?
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited February 2014
    You need to use a vector to angle expression in a behavior. In order to do that you would need to log the position of each obstacle and address each collision. Other than that it's just going to be random and you'll need to just play with density et.. To find the right mix.


    EXAMPLE

    Change Velocity behavior

    Direction:
    VectorToAngle(self.position.X - obstacle.position.X, self.position.Y - obstacle.position.Y)
  • BonepileGamesBonepileGames Member Posts: 194
    @FryingBaconStudios

    Could you please make a demo of your example because I cannot really figure it out nor implement it?

    Thank you
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Sorry I don't have the time to make a demo. I know others do that but it's not something I do. Maybe @Socks will make you one he does that kind of stuff.
  • BonepileGamesBonepileGames Member Posts: 194
    @FryingBaconStudios

    Thank you for your support.

    I hope Socks will give me a hand.
Sign In or Register to comment.