How do I avoid that an object(ball) goes through the obstacle?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hi,
    In a kind of bat and ball game there are 2 obstacles the ball bounces against it.
    Sometimes when it's between the obstacle and the paddle it goes through the obstacle,
    and it's gone. Any idea?

    Thank you,
    Ineke

  • This is the logical flow of what you describe:

    - Ball Moves
    - Ball collision Check
    - ( End of code ) The Visual Frame Updates

    This is what you need to do

    - Store Balls current position ( this wil be the Balls previouas coordinates )
    - Ball Moves
    - Draw a Line from 'Balls previous coordinates' to 'Balls current coordinates'
    - Line collision Check ( replaces Ball colision check )
    - Remove Line ( depending on how your code works )
    - ( End of code ) The Visual Frame Updates

    ...
    You could of cource make do with Fast Loop movement, but in my oppinion thats more complicated and less efficient

    How can i change username and display name?
    Please login to see this link.

  • This is your problem.
    Please login to see this picture.

    Your Ball moves so fast that it "jumps over" the Bat, and never overlapp/ collides with the Bat.

    If you draw a kind of Trajectory Line between each time the Ball moves, you will be able to adress the question "Did the Ball collide with the Bat?" by checking if the Line is overlapping the Bat ( instead of the Ball ).
    Please login to see this picture.

    How can i change username and display name?
    Please login to see this link.

  • Glad you got it solved, but I think that was a bit over complicated. The issue most likely was that the randomization of the ball movement made it go in the wrong direction. In that case you have to force it to pick a random direction that moves it back in the opposite direction. Basically, ball collides with bat 1, set ball direction to random directions you selected. Then it can't go backwards through the bat. I'm not sure they were making a pinball movement, seems like it could be more of a pong movement.

    But I guess if your example helped them solve it that's all that matters.

  • Please login to see this attachment.

    The problem is, when the ball is between the player and the bounce obstacle left and right.
    The ball went through the obstacle and leaves the play area.

    Thank you,
    Ineke

  • Ineke, King_Cools example was good and not over complicated IMO . Seems you are new to making games? What I would do is go to the tutorials here on the site and click on the tab that say's "open source files" in there you'll find an open source game called "Chaos Breakout". It is a good example of what you're looking for and will explain what you need done. you will learn a lot from it. It was well done. Hope this helps!

    [SIGPIC][/SIGPIC]Please login to see this link.
    Please login to see this link.

  • this kind of problem may happen if you use "repeat while object is other object" instead of "Collision with other object".
    Check you code. In the event that makes the ball bounce, just check that you are using "Collision between A and B" and not the other condition.
    As said before, it can also help to set the randomizer of the ball movement of the ball to 0 : in the movement properties of the ball, set "randomizer" to 0
    Please tell us if it has solved the problems

    Francois
    PM: Please login to see this link.

  • Seems you are new to making games? What I would do is go to the tutorials here on the site and click on the tab that say's "open source files" in there you'll find an open source game called "Chaos Breakout". It is a good example of what you're looking for and will explain what you need done. you will learn a lot from it. It was well done. Hope this helps!

    Hi Klik-iT
    No I'm not new to making games.

  • Klik-It,
    Never mind :)

    To all

    Think it's because the player has a detector with custom movement, controlled by the multiple touch object. I have to find a way to give
    the player a bounce at the place where the obstacle is. Hope you'll understand what I mean.
    Thank you,
    Ineke

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!