lol gamedev
1
Name:
Anonymous
2007-09-20 8:08
ID:ZhhHGPCH
spot the error
// Object-to-object, reduced bounding-box collision detector:
short int Sprite_Collide(sprite_ptr object1, sprite_ptr object2) {
int left1, left2;
int right1, right2;
int top1, top2;
int bottom1, bottom2;
left1 = object1->x + object1->col_x_offset;
left2 = object2->x + object2->col_x_offset;
right1 = left1 + object1->col_width;
right2 = left2 + object2->col_width;
top1 = object1->y + object1->col_y_offset;
top2 = object2->y + object1->col_y_offset;
bottom1 = top1 + object1->col_height;
bottom2 = top2 + object2->col_height;
if (bottom1 < top2) return(0);
if (top1 > bottom2) return(0);
if (right1 < left2) return(0);
if (left1 > right2) return(0);
return(1);
};
2
Name:
Anonymous
2007-09-20 8:22
ID:Heaven
I found it: The code doesn't use Lisp.
3
Name:
Anonymous
2007-09-20 8:23
ID:Heaven
Oh, there's another one: Only fags use () for return.
4
Name:
Anonymous
2007-09-20 8:40
ID:TOf2w2wF
I know, I know! This code doesn't use XML at all! This will never scale. And directly accessing the sprites properties? Puh-leeze, what is this, 1980? Nice portable assembler, hon. What this code need is some encapsulation. We'll spruce it up with some getter and setter functions, give it a look that says "I am in control of my own state".
Just sit back and relax, cause when I'm done, baby, your code is going to look fabulous !
5
Name:
Anonymous
2007-09-20 8:58
ID:wAA7Iiwp
6
Name:
Anonymous
2007-09-20 8:59
ID:J8KVZPzg
> != >=
7
Name:
Anonymous
2007-09-20 9:23
ID:FrmRTxm7
if (bottom1 < top2) return(0);
if (top1 > bottom2) return(0);
if (right1 < left2) return(0);
if (left1 > right2) return(0);
Non-exhaustive patterns in function Sprite_Collide
8
Name:
Anonymous
2007-09-20 9:25
ID:KCVuhzLh
What happens when one object is completely inside the other?
9
Name:
Anonymous
2007-09-20 9:51
ID:A25gcm9c
bottom = top + height
should obviously be:
top = bottom + height
10
Name:
Anonymous
2007-09-20 9:52
ID:wAA7Iiwp
>>8
Nesting, not unlike that of a bird.
11
Name:
Anonymous
2007-09-20 10:29
ID:7MfP+ydu
12
Name:
Anonymous
2007-09-20 12:31
ID:9kSo6NLc
>>9
(0, 0) is
obviously in the top left corner
13
Name:
Anonymous
2007-09-20 12:51
ID:Heaven
top2 = object2->y + object1->col_y_offset;
14
Name:
Anonymous
2007-09-20 13:47
ID:tpQEyTGW
>>12
In OpenGL it's the bottom-left corner.
15
Name:
Anonymous
2007-09-20 14:35
ID:ZhhHGPCH
You're all retarded. Here's the correct code:
collides :: Rect -> Rect -> Bool
collides ((a,b), (c,d)) ((e,f), (g,h)) =
(d < f && b > h) || (a < g && c > e)
can you spot the error in the original?
16
Name:
Anonymous
2007-09-20 14:39
ID:SRRHP2qB
>>14
you're a fucking idiot. That's blatantly false.
17
Name:
Anonymous
2007-09-20 15:19
ID:TOf2w2wF
>>16
It can be, if you want it to.
18
Name:
Anonymous
2007-09-20 16:39
ID:4dGLQdbu
It needs the <=> operator
19
Name:
Anonymous
2007-09-20 17:59
ID:HE5W5BKM
Uh, in OpenGL (0,0) is the bottom-left corner of the plane. Get it right, new fags.
20
Name:
Anonymous
2007-09-20 20:17
ID:el8zAX9F
uses faggot coordinate system (left-handed)
21
Name:
Anonymous
2007-09-20 23:46
ID:Heaven
"short int"
22
Name:
Anonymous
2007-09-21 13:04
ID:zHDvXszQ
>>20
I masturbate with my right hand. Which coordinate system should I use?
23
Name:
Anonymous
2007-09-21 14:53
ID:XWdqCkqr
24
Name:
Anonymous
2007-09-21 14:55
ID:Heaven
>>23
Too bad that xkcd sucks
25
Name:
Anonymous
2007-09-21 16:11
ID:XWdqCkqr
>>24
Too bad there's an xkcd for every situation.
26
Name:
Anonymous
2007-09-21 16:29
ID:6l0c3uQr
top2 = object2->y + object1->col_y_offset; // What the fuck? object1?
27
Name:
sage
2007-09-21 16:50
ID:Heaven
>>23
XKCD SPOTTED
AUTOSAGING ENGAGED
SAGE
28
Name:
Anonymous
2007-09-21 17:18
ID:UZaw9GJ7
>>25
And what of it? They aren't funny in most cases.
29
Name:
Anonymous
2007-09-21 17:37
ID:XWdqCkqr
>>28
All I know is that I've seen more good jokes from xkcd than from you. Pot, meet kettle.
30
Name:
Anonymous
2007-09-21 17:40
ID:Heaven
>>29
My other car is a cdr.
32
Name:
Anonymous
2010-12-09 15:45
33
Name:
Anonymous
2011-01-31 20:37
<-- check em dubz
Newer Posts