@Edmanbosch wrote:
So, I've been trying to figure out how to do collisions, and while what I got works, I'm afraid it may be a bit inefficient.
So, I have a function called
PlaceMeeting
and when myUpdate
of my game objects gets called, it will detect some input and moves, and then check for collisions.It detects collisions by checking on the x-axis, and if it's about to collide, it will loop until it is ~1 pixel away from the object, and the sets the velocity to zero. It's the same for the y-axis.
What I'm concered about is how in the
PlaceMeeting
function it does a loops through a list of objects with aforeach
loop, and then checks collisions. It does this every time it's called.I'm worried this may be inefficient, and could cause lag when my game starts getting bigger. Is this gonna be a problem, or will it be fine if I leave it as it is?
Posts: 1
Participants: 1