Jump to content
  • Advertisement
Sign in to follow this  
phil67rpg

slot machine

This topic is 2697 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

Well I am building a slot machine game using direct x and c++. I have got the reels to move down the screen but I want them to disappear when they hit the bottom of the screen. Here is some of my code.
[font="Consolas"][font="Consolas"][/font][/font][font="Consolas"][color="#008000"][font="Consolas"][color="#008000"][font="Consolas"][color="#008000"]//start rendering

[/font][/font][/font][font="Consolas"][font="Consolas"][/font][/font][font="Consolas"][color="#0000ff"][font="Consolas"][color="#0000ff"][font="Consolas"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][font="Consolas"] (d3ddev->BeginScene())

{

RECT rect;

rect.left=100;

rect.right=300;

rect.top=0+i;

rect.bottom=100+i;

i+=5;

[/font][/font][font="Consolas"][color="#0000ff"][font="Consolas"][color="#0000ff"][font="Consolas"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][font="Consolas"](i>=500)

{

i=0;

}

[/font][/font][font="Consolas"][color="#008000"][font="Consolas"][color="#008000"][font="Consolas"][color="#008000"]//draw surface to the backbuffer

[/font][/font][/font][font="Consolas"][font="Consolas"]d3ddev->StretchRect(surface, NULL, backbuffer, &rect, D3DTEXF_NONE);

thanks for your help.

[/font][/font]

Share this post


Link to post
Share on other sites
Advertisement

Well I am building a slot machine game using direct x and c++. I have got the reels to move down the screen but I want them to disappear when they hit the bottom of the screen. Here is some of my code.
[font="Consolas"] [/font][font="Consolas"][color="#008000"][font="Consolas"][color="#008000"][font="Consolas"][color="#008000"]//start rendering

[/font][/font][/font][font="Consolas"] [/font][font="Consolas"][color="#0000ff"][font="Consolas"][color="#0000ff"][font="Consolas"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][font="Consolas"] (d3ddev->BeginScene())

{

RECT rect;

rect.left=100;

rect.right=300;

rect.top=0+i;

rect.bottom=100+i;

i+=5;

[/font][/font][font="Consolas"][color="#0000ff"][font="Consolas"][color="#0000ff"][font="Consolas"][color="#0000ff"]if[/font][/font][/font][font="Consolas"][font="Consolas"](i>=500)

{

i=0;

}

[/font][/font][font="Consolas"][color="#008000"][font="Consolas"][color="#008000"][font="Consolas"][color="#008000"]//draw surface to the backbuffer

[/font][/font][/font][font="Consolas"][font="Consolas"]d3ddev->StretchRect(surface, NULL, backbuffer, &rect, D3DTEXF_NONE);

thanks for your help.

[/font][/font]


You really should use more descriptive variable names and object oriented programming techniques. Also your using DX so why not make the reels 3D? You would have a UV texture of your reel images and then rotate your reels to make them spin.

Anyway in regards to your original question you could simply not draw if the Y coordinate is greater than a certain value, or you could draw over the image to hide it. Also please use constants rather than magic numbers in your code..

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!