Thread: Need Code

  1. #1
    eat my shorts!
    Join Date
    Apr 2002
    Posts
    294

    Need Code

    i need a working code in C++ (windows platform). It should be able to move a ball on the screen.

    a nicely commented code will be aprecitated.


    thxs

  2. #2
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Hehe
    2. Don't ask people to do all your work for you
    Btw, is this a troll or something?
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Usually, people don't like "Do this code for me" posts, but... anyway, I'll give this general idea to you:
    Code:
    while(GameIsOn)
    {
       Ball.X += Ball.dX;
       Ball.Y += Ball.dY;
    
       if(Ball.X < LEFT_SIDE_OF_SCREEN)
       {
          Ball.X = LEFT_SIDE_OF_SCREEN;
          Ball.dX = -Ball.dX;
       }
    
       if(Ball.X > RIGHT_SIDE_OF_SCREEN)
       {
          Ball.X = RIGHT_SIDE_OF_SCREEN;
          Ball.dX = -Ball.dX;
       }
    
       if(Ball.Y < TOP_SIDE_OF_SCREEN)
       {
          Ball.Y = TOP_SIDE_OF_SCREEN;
          Ball.dY = -Ball.dY;
       }
    
       if(Ball.Y > BOTTOM_SIDE_OF_SCREEN)
       {
          Ball.Y = BOTTOM_SIDE_OF_SCREEN;
          Ball.dY = -Ball.dY;
       }
    }
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    mov.w #$1337,D0 Jeremy G's Avatar
    Join Date
    Nov 2001
    Posts
    704

    Talking I too, need code as well!

    Please post the code (nicely commented) for a state of the art First Person Shooter. It should have 20 levels, and 30 player models as well as pre compiled resources. It should work in both DX and GL depending on the users settings. Thanks.
    c++->visualc++->directx->opengl->c++;
    (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)

  5. #5
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640

    Re: I too, need code as well!

    Originally posted by dbgt goten
    Please post the code (nicely commented) for a state of the art First Person Shooter. It should have 20 levels, and 30 player models as well as pre compiled resources. It should work in both DX and GL depending on the users settings. Thanks.
    Haha, yeah ok, you made your point by now.
    Indeed it smells alot like homework. So go look around for
    yourself first.
    A place to start

  6. #6
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331

    Re: I too, need code as well!

    Originally posted by dbgt goten
    Please post the code (nicely commented) for a state of the art First Person Shooter. It should have 20 levels, and 30 player models as well as pre compiled resources. It should work in both DX and GL depending on the users settings. Thanks.
    Also, it must know what i want so that it can program itsself, for when it comes to doing code myself i become quite confused. Please use my name in given credits, as i will tell all my l337 friends that i haxx0r'd the code myself, being how l337 i am.

  7. #7
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640

    Re: Re: I too, need code as well!

    Originally posted by RoD
    Also, it must know what i want so that it can program itsself, for when it comes to doing code myself i become quite confused. Please use my name in given credits, as i will tell all my l337 friends that i haxx0r'd the code myself, being how l337 i am.
    HAHAH! You're wonderfull, i'l bet he has a trauma by now

  8. #8
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331

    Re: Need Code

    Originally posted by dayknight
    i need a working code in C++ (windows platform). It should be able to move a ball on the screen.

    a nicely commented code will be aprecitated.


    thxs
    screw it i'll do it:

    Code:
    int CreateBall(I_WANT_YOU_TO_MAKE_A_BALL)
    {
        NOW_DO_IT = TRUE;
        RETURN MY_BALL_JERK;
    }

  9. #9
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    HAHAHA!

    // Something was here but i laughed so hard i coulnd't finish it

  10. #10
    napKINfolk.com napkin111's Avatar
    Join Date
    Apr 2002
    Posts
    310
    I had to do that for my Java final (it was in a basic class but my teacher decided to give me and a friend an "advanced" final). I had to be able to set up a variable sized grid (2x3, 4x20, etc), and make a ball start in the upper left and bounce at a 45 degree angle until it hits a corner. Then, I had to output how many times it bounced. I was trying not to laugh when he told me what to do cause I still remember all the code from when I programmed my breakout clone :P My friend had a collision check for each of the 4 directions (NE,NW,SE,SW) on each of the 4 walls, so he had 8 collision detections :P I told him it was much simpler to check if the ball was touching a wall and then just reverse the trajectory of the according axis, but he didn't have that either :P Ah...well...maybe you had to be there...

    //napKIN
    "The best way to get answers is to just keep working the problem, recognizing when you are stalled, and directing the search pattern.....Don’t just wait for The Right Thing to strike you – try everything you think might even be in the right direction, so you can collect clues about the nature of the problem."
    -John Carmack

  11. #11
    eat my shorts!
    Join Date
    Apr 2002
    Posts
    294
    what header files do i need?

  12. #12
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640

    Re: Re: I too, need code as well!

    Originally posted by Travis Dane
    A place to start
    It's all in there

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM