Kick Ball

  • I wanted to throw a ball with impulse the selected direction. try to do but fail <img src="smileys/smiley36.gif" border="0" align="middle" />

    Anyone know how to do?

    <img src="http://i57.tinypic.com/ivv8xw.png" border="0" />

  • <img src="smileys/smiley18.gif" border="0" align="middle" />

  • Apply physics component to the ball, then on mouse click choose "Apply impulse towards position:

    Impulse: whatever value you want, you can use distance(ball.x,ball.y,mouse.x,mouse.y) for example

    PositionX: mouse.x

    PositionY: mouse.y

    image point: 0

  • I have several problems:

    • When you click-on the ball shoots out in any direction, I would like to create an arrow to indicate the direction
    • With the ball falls physical gravity, I want this stopped.

    <img src="smileys/smiley6.gif" border="0" align="middle" />

  • If you are launching the ball from a tube or similar, it could be that the impulse force is bouncing off of the object it's launching from. In which case it would be an idea to move it a few pixels away so it has a 'clean' launch area before the impulse force. This shouldn't be too obvious due to the quick frame refresh.

    With regards to the arrow - that's a different question to what you originally posted, it's worth a separate topic.

    If you don't want to ball to fall, then set gravity to 0. Physics works without gravity as well i.e. as in space.

  • This might give you a starting point

  • The arrow is in the picture I posted, so also wanted tips or tutorial

  • RamPackWobble When launched the ball does not stop at all and tell me you would know how to make a directional arrow <img src="smileys/smiley9.gif" border="0" align="middle" />

    A game like this youtube.com/watch

  • create the image of the arrow, set it's angle to:

    angle(sprite.x,sprite.y,mouse.x,mouse.y)+180

    Arrow done!

  • Not stopping ?

    Look at the balls density, friction and dampening setting to alter how quickly it will stop.

    (I have altered these setting the original capx and re-uploaded it. Also added a second ball to hit)

    demo

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • demo 2

    and the capx

  • Thank you rampack, you can send the CapX? the links are the wrong way :P

    The arrow can be taken out of the ball does not? :D

  • i also want to say that look at the balls density, friction and dampening setting to alter how quickly it will stop.

    If you are launching the ball from a tube or similar, This shouldn't be too obvious due to the quick frame refresh.

  • Thank you rampack, you can send the CapX? the links are the wrong way :P

    The arrow can be taken out of the ball does not? :D

    oops <img src="smileys/smiley9.gif" border="0" align="middle">

    "The arrow can be taken out of the ball does not?" Zen ? <img src="smileys/smiley5.gif" border="0" align="middle">

  • works perfect, thank you very much <img src="smileys/smiley4.gif" border="0" align="middle" />

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