Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

lol gamedev

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);

    };

Name: Anonymous 2007-09-20 8:22 ID:Heaven

I found it: The code doesn't use Lisp.

Name: Anonymous 2007-09-20 8:23 ID:Heaven

Oh, there's another one: Only fags use () for return.

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!

Name: Anonymous 2007-09-20 8:58 ID:wAA7Iiwp

>>3
ding ding ding

Name: Anonymous 2007-09-20 8:59 ID:J8KVZPzg

> != >=

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

Name: Anonymous 2007-09-20 9:25 ID:KCVuhzLh

What happens when one object is completely inside the other?

Name: Anonymous 2007-09-20 9:51 ID:A25gcm9c

bottom = top + height
should obviously be:
top = bottom + height

Name: Anonymous 2007-09-20 9:52 ID:wAA7Iiwp

>>8
Nesting, not unlike that of a bird.

Name: Anonymous 2007-09-20 10:29 ID:7MfP+ydu

>>8
Fairy hentai?

Name: Anonymous 2007-09-20 12:31 ID:9kSo6NLc

>>9
(0, 0) is obviously in the top left corner

Name: Anonymous 2007-09-20 12:51 ID:Heaven

top2 = object2->y + object1->col_y_offset;

Name: Anonymous 2007-09-20 13:47 ID:tpQEyTGW

>>12
In OpenGL it's the bottom-left corner.

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?

Name: Anonymous 2007-09-20 14:39 ID:SRRHP2qB

>>14
you're a fucking idiot. That's blatantly false.

Name: Anonymous 2007-09-20 15:19 ID:TOf2w2wF

>>16
It can be, if you want it to.

Name: Anonymous 2007-09-20 16:39 ID:4dGLQdbu

It needs the <=> operator

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.

Name: Anonymous 2007-09-20 20:17 ID:el8zAX9F

uses faggot coordinate system (left-handed)

Name: Anonymous 2007-09-20 23:46 ID:Heaven

"short int"

Name: Anonymous 2007-09-21 13:04 ID:zHDvXszQ

>>20
I masturbate with my right hand.  Which coordinate system should I use?

Name: Anonymous 2007-09-21 14:53 ID:XWdqCkqr

Name: Anonymous 2007-09-21 14:55 ID:Heaven

>>23
Too bad that xkcd sucks

Name: Anonymous 2007-09-21 16:11 ID:XWdqCkqr

>>24
Too bad there's an xkcd for every situation.

Name: Anonymous 2007-09-21 16:29 ID:6l0c3uQr

top2 = object2->y + object1->col_y_offset; // What the fuck? object1?

Name: sage 2007-09-21 16:50 ID:Heaven

>>23
XKCD SPOTTED

AUTOSAGING ENGAGED

SAGE

Name: Anonymous 2007-09-21 17:18 ID:UZaw9GJ7

>>25
And what of it? They aren't funny in most cases.

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.

Name: Anonymous 2007-09-21 17:40 ID:Heaven

>>29
My other car is a cdr.

Name: Anonymous 2010-12-09 15:45

Name: Anonymous 2011-01-31 20:37

<-- check em dubz

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List