[SOLVED] Power of propelling ball based on mouse pull back

0 favourites
  • 3 posts
From the Asset Store
75 power-up sound effects; bonus and notification sounds, fanfares, harp glissandi, stabs, clock ticks, etc.
  • G'day Guys,

    I'm sure the title is cryptic. I don't know terminology and I belive my inexperience in Construct is my flaw here. I can't for the life of me work out a concept on how to do the following:

    Basic ball game. Think similar to pool, marbles, even a sling-shot style game such as Angry Birds.

    Help needed with concept / thoughts: Click on the ball, pull backwards. The further you pull back the harder the push / force. (atm it's just clicking on the ball and releasing that works for a pre-coded force)

    I am using a screen full of balls and physics. (picture like a pool table).

    Click and release is working just fine. It took me a while to work out how to make a directional arrow point where I wanted it to.

    Capx attached (very small so far, very little code. Purple ball is the only ball working.

    [attachment=0:3p5k86up][/attachment:3p5k86up]

    Thanks in advance :*

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You should calculate the Force using the distance and min functions:

    min(distance(Sprite.X, Sprite.Y, Mouse.X, Mouse.Y), 200)

    The above sets the force applied to the sprite by getting the distance between it and the mouse but will not apply a force higher 200. Remember, min always chooses the lowest value of the options passed into it. Play around with the second value until you feel you have a good max value. Also, if the distance doesn't quite feel like it is giving enough force, do a multiple of the distance. For example, you could multiply the distance by 1.5.

    I hope that gets you what you need and good luck with your project.

  • Thanks FragFather. That seems to be exactly what I needed and shouldn't be too hard to convert into some form of visual for the interface

    I really appreciate it and yes yet again my limitation is my inexperience THANKS !!!

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