Results 1 to 8 of 8

Thread: Need help in a breakout game

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90

    Question Need help in a breakout game

    Hi.
    I'm doig a breakout game using DirectX and DirectDraw. I have used the keyboard to move the pad and the ball. But the problem is that when the ball is moving, if i try to move the pad the ball will stop in its place. Can someone plz help me with my problem? This is very urgent.
    I would appreciate it also if someone has a breakout game made using DX and DirectDraw that I can base my work on.
    Thank you a lot.

  2. #2
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Hmm, I'm not sure I understand the problem exactly - is this right? The ball stays stationary while you move the paddle, and doesn't continue to move until you leave the paddle still?

    If I've understood correctly, then it sounds like you need to collect your input and act on it a little differently. Generally you shouldn't act on your input as soon as you collect it, you store the input and then apply changes to the components of the game (the paddle, ball and bricks in this case) all at the same time, once you have collected the input. Your architecture should look something like this:

    Code:
    Do While Game.Running = True
        CollectInput()
        PerformGameLogic()
        RenderGraphics()
        WaitForNextCycle()
    Loop
    That's a very simple example. Is this more or less how you are doing it?
    Harry.

    "From one thing, know ten thousand things."

  3. #3
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    For us to analyse the problem, some code would help a lot

    I've made my own Break-Through program before, but in BitBlt.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  4. #4
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Maybe if you post the code that's going wrong we will have a better idea of what's going wrong.
    Harry.

    "From one thing, know ten thousand things."

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    This is the code i've come up with until now
    Attached Files Attached Files

  6. #6
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Here you go. I've basically changed the input code to assign an array of 256 booleans (each representing a keycode) a value of true or false. When a key is pressed, key(keycode) is assigned true, and when the key is released the value is assigned false. Take a look through the code, I've commented some of it out and added some new code.
    Attached Files Attached Files
    Harry.

    "From one thing, know ten thousand things."

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90

    Wink

    Thank you HarryW you helped a lot
    I really appreciate it

  8. #8
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827

    Thumbs up

    No problem
    Harry.

    "From one thing, know ten thousand things."

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