Having some difficulty with collision detection… Not sure if it’s because how I set everything els up or what
Here is my code so far w/o collision detection added in… Tips?
b.c=color(35, 197, 85, 255)
background(75, 184, 196, 255)
if timer>1/PipeFrequency then
for i,b in pairs(B) do
if b.y<-b.w then
moveVec = vec2(Gravity.x, HEIGHT/2) + vec2( 0, 0)
position = position + moveVec * 20
What exactly is your question?
Try reading some of the stuff on the wiki, almost everything involves collisions
@ignatz, his/her trouble is that the ball doesn’t collide with things and go trough instead diying
@Mark.T Are you having trouble with actual collision code, or are you having trouble with where to start with collision detection. There’s 2 ways to do collision detection. One is using the physics engine, the other is by writing your own code to see if the x,y positions of objects are within a certain distance of each other. You don’t say which way you’re trying.
@TokOut - his problem is not that his ball isn’t colliding - that’s because he hasn’t put collision code in yet!
His problem is that he doesn’t know how to do collisions - and there is a lot of sample code about collisions, as well as tutorials.
I am simply saying - before you ask on the forum, try looking in the wiki, searching the forum for past answers, etc. You could use that advice, too.
Ok, collision will be my next lua-subject to learn