How do I make this Golf power meter mechanics

  • Hi guys,

    I would love some help on how to make a similar golf power meter mechanics as in this game: https://www.scirra.com/arcade/sports-ga ... -golf-1333

    Once you hold down your mouse button anywhere on the screen, then drag forward, the power meter on the ball will increase.

    Would really appreciate some hints on how to make something like that!

    Cheers!

  • Fairly easy to do although the tweaking of actual force values is up to you. On mouse button released you would apply a force toward position (physics behaviour) on the ball, where the position is mouse.x,mouse.y. To change the force based on drag distance you could detect the distance between initial click and button release and add this value to the default force value, so the longer the distance then its force+distance, it will travel further.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you, that makes sense!

    And how would you go about displaying the power meter, not sure how to make it grow like in the example above

  • Create a sprite on click down, set its angle to touch and increase its height as you move away from initial touch.x, touch.y.

  • That is not a good design for mobiles though. Your finger will cover too much of the power bar and you will not be able to see exactly how much power there is and it's generally not a good idea to have to stick a finger in the middle of the screen in games like this.

    I always go for, tap/click behind the ball and move away from the ball in the opposite direction of the power bar. That way you see everything clearly

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)