A simple RPG game

Source: Internet
Author: User

The performance of the game is shown below:

Hello everyone, this is my first time to write this game, what's wrong? I hope you can point out that my pictures of this game all come from the network above a hero save the United States RPG game, but I downloaded after the discovery can not run, I took a few days to write a relatively simple. Here, I thank the hero Save the beauty of the author's picture.

In my simple game here, I used DirectX to write, the main function has bmove (int &zhi)

The following is a section of the code for this function:

Pbbuf->bltfast (0, 0, Popla[zai], CRect (0,0,640,480), ddbltfast_wait);
if (tab)
{
If you press the space bar, you will show the hero.
Pbbuf->bltfast (0, 380, popla[13], CRect (0, 0, 640,100),
Ddbltfast_wait| Ddbltfast_srccolorkey);
Pbbuf->bltfast (5, 385, popla[14], CRect (0, 0, 85,85),
Ddbltfast_wait| Ddbltfast_srccolorkey);
}
if ((whero.x1-30 = = hero.x1) && (whero.y1 = = hero.y1))
{
NUMX = 1; If the protagonist and the characters in the game together, then return.
Whero.x1 + 10;
Return
}
if ((whero.x1 + = = hero.x1) && (whero.y1 = = hero.y1))
{
NUMX = 1;
if (num = 20)
{
NUMX = 0;
}
WHERO.X1-= 10;
Return
}
if (Hero.y1 > Whero.y1)
{
Pbbuf->bltfast (whero.x1, Whero.y1, Popla[zhi], CRect (0,0,40,40),
Ddbltfast_wait| Ddbltfast_srccolorkey);
Pbbuf->bltfast (hero.x1, Hero.y1, Popla[hero.control], CRect (0,0,40,40),
Ddbltfast_wait| Ddbltfast_srccolorkey);
}
else if (hero.y1 <= whero.y1)
{
Pbbuf->bltfast (hero.x1, Hero.y1, Popla[hero.control], CRect (0,0,40,40),
Ddbltfast_wait| Ddbltfast_srccolorkey);
Pbbuf->bltfast (Whero.x1, Popla[zhi], CRect (0,0,40,40),
Ddbltfast_wait| Ddbltfast_srccolorkey);
}
Ppsur->flip (NULL, ddflip_wait);
}

There are some more important functions that are implemented in the OnTimer () function. You can look at the code specifically.

The specific operation is that the space bar is used to talk to the characters in the game and show what the protagonist wants to say, using the keyboard to manipulate the protagonist's action.

Finally, I want to love the game to write more people and I contact, after all, I learned DirectX programming only more than 10 days of time.

My email address is: xieyuntian1981@21cn.com

QQ is: 109021029

This article supporting source code

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.