Hello. Just bought this course on Udemy and I’m at the last chapter of the Axe Game. Now, I’m not sure if there is a bug of some sort since I’m using Raylib 5.0, but there is an issue where my circle will move in one direction for a small distance, but then change distance and then move a short distance before going in the original direction…over and over. At times even ending up off screen. My code does not look much different from the finished code on gitlab, so I’m not sure where this bug comes from.
EDIT: I just saw what the issue was with my circle movement thanks to another post in which the user was having the same issue. (I originally didn’t open that thread thinking it wasn’t related). The answer is both the circle and the rectangle need their own movement speeds. Using the same for both makes the circle change direction when the square does. I can’t believe I didn’t see it when I was testing it out.
Also, shouldn’t we be using || instead of && when looking for collision? wouldn’t && be looking for every parameter to be true before declaring that the bool is now true? Why not initialize the bool as false first, then update it in the while loop?
Wouldn’t it make more sense to use an if - elseif branch for collision? If it collides then assign the bool to be true, or would that slow the program down constantly checking those conditions?