Edit-- I edited this rather than clutter up the forum with another thread.
Would there be a ‘simple’ way of making pairs of rectangles moving up the screen have collision detection?
Ie ‘---------- ----------’ and ‘----- ---------------’ and ‘-------- ------------’
I want objects to collide and bounce off where the rectangles ‘–’ are, but the objects will fall through the gaps.
I have tried myself, after trying several different ideas I took to reading the builtin reference guide for physics but it makes my brain melt when it talks of weird alien things like vec2 etc.
If there is no ‘very easy’ way to do this, just tell me and I’ll move on to a simpler idea.
I’ve been playing with this all afternoon, I got my line to move and the ball is controlled by tilting the pad but the ball doesn’t fall through the gap.
Some advice would be wonderful (and yeah, I know my code will be terrible)
-- Use this function to perform your initial setup
-- This function gets called once every frame
-- This sets a dark background color
background(40, 40, 50)
-- This sets the line thickness
-- Do your drawing here
Instead of x, use
Why? Cause ball.x is not inside the gap and thats why the ball cant fall through.
@SteveNoob Does this code help any.
background(40, 40, 50)
Thanks both of you.
dave, wow… you not only made it smaller but its smoother and works perfectly.
Thank you, mine looks so messy and terrible next to yours.
@SteveNoob, my apologies, I did not mean to write the entire thing for you. It still needs polishing to be a game for example there is no winning or losing, graphics are very plain etc, but regardless I have removed the code above so you can continue to explore how to do this yourself.
JakAttak, I’m sorry for what I said.
I’m just so frustrated and I feel like I’m really really stupid and thick. I’ve decided Codea is beyond my old brain and I’ll leave the coding to you experts.
Take care and again, sorry for being mean.
@SteveNoob You feel that way because you don’t understand Lua and Codea. None of us were born experts. You just have to start out small. Don’t try to write something beyond what you know. Start with what you understand, then start adding another command or function and try different things with that. Once you understand what that’s doing, add something else and play with that. Eventually you’ll understand enough to write what you want. I’ve been playing around with Codea a little over a year and there’s still more that I don’t understand than I do. Don’t expect to know it all overnight because it isn’t going to happen. Try things and if you still can’t figure it out, ask. Take small examples of code that are given on the forum and try to understand what they’re doing. Comment out lines of code or change something and see what happens. Experiment.
You wrote the entire game for me…
Well I guess theres no point me bothering now. …great
@SteveNoob He didn’t write the game for you because nothing says you have to use his. Continue to write your game on your own to learn and if you get stuck on something that doesn’t work, you can refer to his game to see how it was done. Just about everything on this forum has already been written in one form or another. There have been things that some people have asked about that I’ve already written 25-30 years ago. There are very few original ideas that are showing up and the Internet is loaded with examples of most of them. So don’t stop, there’s a lot more you still have to do and learn.