Jump to content
  • Advertisement
Sign in to follow this  
phil67rpg

breakout paddle

This topic is 3058 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using direct x and c++ to make a breakout game. I can get the paddle to move but it skips around a little bit. Here is the code I am using.
 
   if (KEY_DOWN(VK_LEFT))
	{			

		d3ddev->ColorFill(surface, NULL, D3DCOLOR_XRGB(255,255,255));
		//copy the surface to the backbuffer
        RECT rectw;
        rectw.left = m--;
        rectw.right = n--;
		rectw.top = 550;
        rectw.bottom = 600;

		d3ddev->StretchRect(surface, NULL, backbuffer, &rectw, D3DTEXF_NONE);

		d3ddev->ColorFill(surface, NULL, D3DCOLOR_XRGB(0,0,0));
		//copy the surface to the backbuffer
        RECT rectx;
        rectx.left = o--;
        rectx.right = p--;
		rectx.top = 550;
        rectx.bottom = 600;

		d3ddev->StretchRect(surface, NULL, backbuffer, &rectx, D3DTEXF_NONE);
	}	

    if (KEY_DOWN(VK_RIGHT))
	{			

		d3ddev->ColorFill(surface, NULL, D3DCOLOR_XRGB(0,0,0));
		//copy the surface to the backbuffer
        RECT recty;
        recty.left = m++;
        recty.right = n++;
		recty.top = 550;
        recty.bottom = 600;

		d3ddev->StretchRect(surface, NULL, backbuffer, &recty, D3DTEXF_NONE);

		d3ddev->ColorFill(surface, NULL, D3DCOLOR_XRGB(255,255,255));
		//copy the surface to the backbuffer
        RECT rectz;
        rectz.left = o++;
        rectz.right = p++;
		rectz.top = 550;
        rectz.bottom = 600;

		d3ddev->StretchRect(surface, NULL, backbuffer, &rectz, D3DTEXF_NONE);
	}

Share this post


Link to post
Share on other sites
Advertisement
Hi phil67rpg,

When you post code, put it in source tags, like this:

[source]...code goes here...[/source]

That will put it in one of those nice little code boxes, which will make it much easier for people to read.

You can fix your current post using the 'edit' button in the upper right.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!