Ball in the Air???

0 favourites
  • 7 posts
From the Asset Store
Enjoy the powerful simulation with accurate ball physics, build with realistic ball spinning animations
  • Hi guys!

    I'd like to try and make a game which its purpose is to keep a ball in the air by clicking on it, gravity being working as in real life.

    for every click i get one point.

    if it touches the ground the game is over.

    i'd like the ball to behave realistically, and with that i mean, if i click on the ball to far out on the right side of the ball its natural reaction is to fly of towards the lest side.

    any ideas guys?

    keep it simple, i am a beginner.

    I'd also like to inform you guys that I've tried to use the physics behavior with no success!

    Thanks you.

  • Physics should work,

    First just set your ball physics so it falls naturally and bounces nicely when it hits the ground ( try gravity and elasticity settings, density will also affect it )

    Once you have that apply impulse at angle depending on where mouse is ( if ball is clicked ) . Straight up angle in construct is -90 so something like -90+(ball.X-Mouse.X)/100

    divided by 100 because most likely impulse would be too strong and it would just fly off screen, but depending on your settings you can adjust that.

  • Try Physics behavior.

    On Touch - apply impulse at angle angle(Touch.x, Touch.y, Ball.x, Ball.y)

  • Thanks a lot guys, such fast reply, amazing!!!

    I'll try it out!

    Thanks

  • oooops, actually I don't know why I put that /100 there, you don't need it. I need more sleep I think.

    That is just the angle calculation, for some reason I was thinking of actual impulse force.

    One thing though; I think it's annoying when you have to click to bounce the ball, just touching it with the cursor is much better, just make it hard enough.

  • hey guys!

    it seems to work ok, it bounces back up as i'm clicking on the ball,

    the only problem is that no matter where on the ball i click it goes stright back up towards one specific angle, it doesn't bounce off to the right or left, and the ball is not rotating as it would in real life,

    does that have to do with the physics behavior?

    what have i missed?

    thank you.

    Yeah no worries i figured it out with the /100 impulse thing.

    it's allright.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I got it!!

    problem solved!

    works fine.

    thank you guys for taking your time!

    Thanks a lot!

    Take care

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