Click here to Skip to main content
Click here to Skip to main content

Games Using Rules BackMan

, 5 Mar 2006 CPOL
Rate this:
Please Sign up or sign in to vote.
A small game using MFC, sound effect, that has many stages

Introduction

BackMan is one of most popular games in the world. It is a simple and beautiful game. In this game, I use rules to find and catch yellow solid. Yellow solid represents the player and others represents adversary. You should find the first path to help you to run away from the adversary.

Back Man

Game explanation:

  • Start Game
    • Welcome screen and sound effect, some simple graphics to login game.
    • End step login start game, the solid yellow in center of screen and adversary in left corner you need to use hot keys to run away from adversary.
    • Hot keys:
      UP Down Left Right
      w s d a
  • Loss
    • If incomplete, the stage "loss", you now replay the stage and lose all points from your balance.
  • Win
    • If you complete the stage, increase your balance of points and go to the later stage, maximum number of adversaries is four.

Using the Code

Monster member function initial "creation monster" and find how many monster numbers there are depending on stage, you now play it .

void CBackManDlg::Monster()
{
 if(Stage1==true)
 {
       CClientDC Mon1(this);
       CBrush Color1;
       Color1.CreateSolidBrush(RGB(255,0,0));
       Mon1.SelectObject(&Color1);
       Mon1.Ellipse(B1,Up1,B2,Up2);
       CBrush Eyes1;
       Eyes1.CreateSolidBrush(RGB(0,0,0));
       Mon1.SelectObject(&Eyes1);
       //eyes
       Mon1.Ellipse(B1+10,Up1+5,B2-20,Up2-20);
       Mon1.Ellipse(B1+20,Up1+5,B2-10,Up2-20);
       //
       Mon1.Rectangle(B1+5,Up1+15,B2-5,Up2-10);
       static int t1=0;

       if(t1%2==0)
            {
        Mon1.Ellipse(B1+5,Up1+15,B2-5,Up2-5);      
       }
       t1++;
    }

     if(Stage2==true)
    {
       CClientDC Mon2(this);
       CBrush Color2;
       Color2.CreateSolidBrush(RGB(0,0,255));
       Mon2.SelectObject(&Color2);
       Mon2.Ellipse(C1,U1,C2,U2);
       CBrush Eyes2;
       Eyes2.CreateSolidBrush(RGB(0,0,0));
       Mon2.SelectObject(&Eyes2);
       //eyes
       Mon2.Ellipse(C1+10,U1+5,C2-20,U2-20);
       Mon2.Ellipse(C1+20,U1+5,C2-10,U2-20);
       //
       Mon2.Rectangle(C1+5,U1+15,C2-5,U2-10);
       static int t2=0;

       if(t2%2==0)
       {
        Mon2.Ellipse(C1+5,U1+15,C2-5,U2-5);    
       }
      t2++;
    }

    if(Stage3==true)
    {
       CClientDC Mon3(this);
       CBrush Color3;
       Color3.CreateSolidBrush(RGB(0,0,255));
       Mon3.SelectObject(&Color3);
       Mon3.Ellipse(S1,N1,S2,N2);
       CBrush Eyes3;
       Eyes3.CreateSolidBrush(RGB(0,0,0));
       Mon3.SelectObject(&Eyes3);
       //eyes
       Mon3.Ellipse(S1+10,N1+5,S2-20,N2-20);
       Mon3.Ellipse(S1+20,N1+5,S2-10,N2-20);
       //
       Mon3.Rectangle(S1+5,N1+15,S2-5,N2-10);
       static int t3=0;

       if(t3%2==0)
       {
           Mon3.Ellipse(S1+5,N1+15,S2-5,N2-5);    
       }
      t3++;
    }
        
    if(Stage4==true)
    {  
       CClientDC Mon4(this);
       CBrush Color4;
       Color4.CreateSolidBrush(RGB(255,0,0));
       Mon4.SelectObject(&Color4);
       Mon4.Ellipse(CC1,UU1,CC2,UU2);
       CBrush Eyes4;
       Eyes4.CreateSolidBrush(RGB(0,0,0));
       Mon4.SelectObject(&Eyes4);
       //eyes
       Mon4.Ellipse(CC1+10,UU1+5,CC2-20,UU2-20);
       Mon4.Ellipse(CC1+20,UU1+5,CC2-10,UU2-20);
       //
       Mon4.Rectangle(CC1+5,UU1+15,CC2-5,UU2-10);
       static int t4=0;

       if(t4%2==0)
       {
           Mon4.Ellipse(CC1+5,UU1+15,CC2-5,UU2-5);
       }
       t4++;
    }
}

Point member function to set points on game you have eat it.

void CBackManDlg::Point()
{
    CClientDC oc(this);

    if(ppoint1==true)
    oc.Ellipse(40,25,50,35);
    
    if(ppoint2==true)
    oc.Ellipse(100,25,110,35);
    
    if(ppoint3==true)
    oc.Ellipse(140,25,150,35);
    
    if(ppoint4==true)
    oc.Ellipse(180,25,190,35);
    
    if(ppoint5==true)
    oc.Ellipse(220,25,230,35);

    if(ppoint6==true)
         oc.Ellipse(260,25,270,35);
    
    if(ppoint7==true)
    oc.Ellipse(300,25,310,35);
    .
    .
    .

BackMan member function - it exactly creates a monster and sets path to it.

voidCBackManDlg::BackMan()
{
 //Mon1
     if(Stage1==true)
    {
        //Down
        if( Up1< y1 ) 
        {    
            if(Up1==50)
            {
            if(B1==25 || B1==85 || B1==375 || B1==430)
             {
                Up1+=55;
                Up2+=55;
             }            
            }
            .
            .
            .          

OnPaint member function loads my setting "Graphics":

void CBackManDlg::OnPaint() 
{
    if(IsIconic())
    {
        CPaintDC dc(this); // device context for painting

        SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

        // Center icon in client rectangle
        int cxIcon = GetSystemMetrics(SM_CXICON);
        int cyIcon = GetSystemMetrics(SM_CYICON);
        CRect rect;
        GetClientRect(&rect);
        int x = (rect.Width() - cxIcon + 1) / 2;
        int y = (rect.Height() - cyIcon + 1) / 2;

        // Draw the icon
        dc.DrawIcon(x, y, m_hIcon);
    }
    else
    {
        CDialog::OnPaint();
        CClientDC b(this);
        CBrush sh;
        sh.CreateSolidBrush(RGB(0,255,255));
             b.SelectObject(&sh);
        b.Rectangle(0,0,500,400);
    }
}

The Future

Here is what I would like to do with the game in the future:

  • Create different style-sheets to apply different themes / looks
  • Keep high scores
    • Got to validate users with some sort of login
    • Use server side scripting (probably ASP.NET / C# ... maybe a web service?) to save high scores
    • Keep track of individual and overall high scores
  • Maybe make the game into an HTML Component (HTC)

History

  • This application was created in 2005, and deployed in 2006.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

yazan_nemer
Web Developer
Jordan Jordan
CAREER OBJECTIVE:
To obtain a challenging position in a fast growing company offering opportunities for professional growth.
 
EXPERINCE:
Software developer from 11 October 2005 until this moment in
Edata Solutions & Tech Consulting. E-Trading Solutions work in ASP.Net
Using VB.Net language.

Comments and Discussions

 
GeneralGame Using Rules BackMan Pinmember174t1-Dec-09 23:25 
GeneralNot being overly rude but... PinmemberIan Harrigan6-Mar-06 3:49 
GeneralDouble Buffering PinmemberJohann Gerell5-Mar-06 20:35 
Generalnice game PinmemberIyad Abu Abdu5-Mar-06 4:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141223.1 | Last Updated 5 Mar 2006
Article Copyright 2006 by yazan_nemer
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid