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
Don't have an account yet? Then register once and completely free of charge and use our wide range of topics, features and great options. As a registered member on our site, you can use all functions to actively participate in community life. Write posts, open topics, upload your pictures, put your videos online, talk to other members and help us to constantly improve our project and grow together! So, what are you waiting for? Become a part of us today!
Login or registerTo get support for a technical issue such as installing the software, to query a purchase that you've made/would like to make, or anything other than using our software, please visit our Customer Service Desk:
Open a TicketHi,
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
Hi King_Cool,
Thank you for answering, honestly I don't understand what you mean.
Can you explain with a small example.
Ineke
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.
Hi,
Thank you for spending your time to make an example. I'll try to work it out.
Ineke
Problem solved, thank you King_Cool.
Ineke
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.
Hi Shawn,
Thought the problem was solved, tomorrow i"ll make a sketch to show what the problem is.
Thank you,
Ineke
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!
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
Hi to all,
Thanks for your reply. I'll try all your suggestions and let you know if the problem has solved.
Ineke
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.
Hi Klik-iT
No I'm not new to making games.
OK, sorry about that and just trying to help.
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
Don’t have an account yet? Register yourself now and be a part of our community!
Almightyzentaco (Fusion 2.5 Tutorials)
Captain Quail (Firefly Tutorials)