Im new here and loving the beginner tutorial series so far. I was watching tutorial 8 and following what Chili was doing, but afterwards i started to write my own code that would do the same things as his (better practice i assumed). I had was at the point in writing the code were the poos would disappear if the face went over them. But when i tested it things got weird. Most of the time when i went over them nothing would happen, sometimes they would disappear, other times they would disappear when the face wasn't even near them (0_0). I honestly have no idea whats wrong with the code, i even tried using the debugger to try to find the problem and only got more confused due to my lack of knowledge with it.
Help please
Own code for tut8, poos are being eaten randomly?
Own code for tut8, poos are being eaten randomly?
- Attachments
-
- chiliframworkcopy.zip
- Hopefully i followed the instructions on how to make it smaller
- (2.42 MiB) Downloaded 107 times
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Own code for tut8, poos are being eaten randomly?
Code: Select all
face_x + 20 <= poo1_x + 24 &&
face_x >= poo1_x &&
face_y + 20 <= poo1_y + 24 &&
face_y > poo1_y
if left_a <= right_b and right_a >= left_b and
top_a <= bottom_b and bottom_a >= top_b
What you have is
if right_a <= right_b and left_a >= left_b and
bottom_a <= bottom_b and top_a > top_b
Code: Select all
face_x + 20 <= poo2_x + 24 &&
face_x >= poo1_x &&
face_y + 20 <= poo2_y + 24 &&
face_y > poo2_y
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
Re: Own code for tut8, poos are being eaten randomly?
Yeah that worked. Thanks so much!
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Own code for tut8, poos are being eaten randomly?
Glad to help.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com