Results 1 to 9 of 9

Thread: C++: Space Invaders [Source]

  1. #1

    Thread Starter
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349

    C++: Space Invaders [Source]

    Here is a same game I made for Uni. I wouldn't say its totally finished but it is good enough to play.

    Don't be afraid of getting shot, the player doesn't die but will get injured. I haven't yet done anything that will make you proper dead if you get to damagd though. The player does regenerate if you do get shot. There is also modelling that means depending where you get shot the effect will be diferent .

    Ow well, Enjoy .
    The Source is in VC++6 . The Graphics Engine isn't mine, I am working on my own that will be in VC++.NET and more optimised though .

    BTW the exe is included incase you don't have a C++ compiler .

    EDIT: Updated the file.
    Attached Files Attached Files
    Last edited by Electroman; Jun 8th, 2004 at 04:01 PM.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  2. #2
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    It ran way too fast on my computer, guess you altered the game loop just before zipping up the project or something.....

    From what i could see it looks good though.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  3. #3

    Thread Starter
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Strange, the Timer code is actually part of the engine that the lecturer made. Its meant to use the performance counter thing to make each frame 20ms , will check it out though.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  4. #4

    Thread Starter
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Try setting a break point on the line I highlighted and see if it gets run. If it does then it would explain it:
    Code:
    GameTimer::GameTimer()
    {
        if(QueryPerformanceFrequency(&freq)==0)    // Find the timer frequency
        {
            freq.QuadPart=0;    // Set to zero if function failed
        }
    
        mdGameRate = 1.0;
    }
    This code is in the gametimer.cpp .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  5. #5
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    Nope. Doesn't get ran.

    EDIT: Just noticed, it's doesn't run fast ALL the time, very occasionally it'll slow down to roughly normal for about half a second. Very strange.....
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  6. #6

    Thread Starter
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    yea I feel a bit silly now, I just checked and the timer isn't used at all . I'm sure it used to be. I'll try and add it in now....
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  7. #7

    Thread Starter
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    There we go, I fixed it, the Timer code weren't half messed up too, I had to edit it quite a bit to get it to work. I acidently set the delay to 20 when testing it, not realising it was in seconds, took me ages to get out of the game .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  8. #8
    Hyperactive Member wiccaan's Avatar
    Join Date
    Apr 2004
    Location
    127.0.0.1
    Posts
    475

    Re: C++: Space Invaders [Source]

    Heh fun little game, cool addon too when you get hit you slow down and cant move for a sec. But yea, runs fast on my computer a little.
    If my post was helpful please rate it

  9. #9
    New Member
    Join Date
    Jan 2013
    Posts
    1

    Re: C++: Space Invaders [Source]

    Hey i have been toying around with your code as a learning tool and it has been great. Right now iam trying to rotate the sprites you have input. How would you go about doing that? Right now i have tried adding in

    DDRAW_INIT_STRUCT(ddbltfx);
    ddbltfx.dwRotationAngle = angle;

    and DDBLT_ROTATIONANGLE to the Blt.

    That all does not seem to be working, when i run the code nothing appears. All the sprites do not load but the game is still running,.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width