HELP --> noob questions :)

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
Raimond
Posts: 16
Joined: January 30th, 2014, 1:54 pm

HELP --> noob questions :)

Post by Raimond » October 5th, 2017, 9:56 am

Hello lovely people, i have started the "Beginner C++ Game Programming DirectX" series with the hope i'll learn enough programming to make my long planned mobile game. i'm stuck at tutorial 8 having this question:

1) I can't understand why this part of the code works in the "bool IsColliding(int x0, int y0 etc)" function:
return
right0 >= x1 &&
x0 <= right1 &&
y0 <= bottom1 &&
bottom0 >= y1;
shouldn't true be returned when the face is in the centre of the poo (when all conditions are true)?
minute: 10:03?


video: https://www.youtube.com/watch?v=7yqV2hyv9Cc&t=1373s

PS: yes, i gave up on programming a while ago becouse i had to learn for university and i'm back for some action + now i have a goal with programming, making my own mobile game. i know these tutorials aren't for mobile programming but they're great for learning programming, exactly what i want. The homeworks are reallly good challanges that many tutorials lack, thanks chilli 8-)

User avatar
Yumtard
Posts: 575
Joined: January 19th, 2017, 10:28 pm
Location: Idiot from northern Europe

Re: HELP --> noob questions :)

Post by Yumtard » October 5th, 2017, 12:35 pm

no, check this out

Image

As you can see, all conditions are true in this example.
Note that in this example all conditions are the same and in the same order as you posted. I just wrote "Top" instead of "y" etc for clarity

Raimond
Posts: 16
Joined: January 30th, 2014, 1:54 pm

Re: HELP --> noob questions :)

Post by Raimond » October 5th, 2017, 2:49 pm

flawless explanation, guess i should've drawn it, thanks

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: HELP --> noob questions :)

Post by chili » October 6th, 2017, 1:29 am

Haha, I was just going to suggest that, but I must have forgotten to hit the fuckin submit button.

When in doubt about stuff like this (spatial stuff), draw a picture ;)
Chili

Post Reply