How do I Make a bounce ball?

0 favourites
  • 10 posts
From the Asset Store
Bouncing ball
$9.99 USD
Template for a bouncing ball game, fully documented in comments and video
  • Hello everyone... I want to make a ball that bounces when it hits the ground. In addition, it moves forward at a certain speed and when it hits the wall it returns to the other side... It is like loop . How can I make it... The picture is to explain the idea.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi, if you don't need to use physics, but just want the ball to bounce, you can use platform behavior on the ball, simulate right control to make it go right and jump control when it collides with the floor

  • It's easy to do with Bullet behavior. Give it gravity and set "Bounce off solids=on".

  • dop2000

    I tried with the bullet... but the movement becomes random... sometimes it goes up a lot and sometimes the ball goes down... I want it to move at the same height, at the same distance, and at the same speed.

  • UltraLion

    Can you tell how I can do it using physics?

  • I tried with the bullet... but the movement becomes random... sometimes it goes up a lot and sometimes the ball goes down... I want it to move at the same height, at the same distance, and at the same speed.

    On collision with the ground, set bullet speed to a fixed value and bullet angle of motion to 270 degrees. It will go up, then drop down again with gravity.

  • Over time the ball could lose some height with most all the behaviors.

    Here’s a way to not lose speed or height over time. The height will vary slightly but stay around the same.

    Var gravity=500
    Var vx=100
    Var vy=0
    
    Every tick
    — add gravity*dt/2 to vy
    — ball: set position to self.x+vx*dt, self.y+vy*dt
    — add gravity*dt/2 to vy
    
    Ball: collides with wall
    — set vx to -vx
    
    Ball: collides with ground
    — set vy to -600
  • UltraLion

    Can you tell how I can do it using physics?

    Hi, unfortunately I don't have the ability to use the behavior of physics, it's not something you can find examples of, I don't know how to handle it.

    But with the method I suggested, the movement is always perfect at the same height. Do you want to create a game like Pang?

  • Its behavior is similar to an inverted parabola. But I'm too lazy to do it through the formula myself, so I did it through the sine behavior.

    kibaga.org/c3-example/file_uploads/index.php

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