签到

06月20日
尚未签到

共有回帖数 0

    做月子

    等级:


    电脑无意发现了这个程序..这是很久很久以前写的了.当时是费了很大的功夫啊.耗时一个星期.结果最后还是没做完.不过大的框架算是做完.也基本能玩了.不知道什么原因做着做着没了兴趣.也就放那了~~~关卡我只写到6关.其实只要你粗略看一下做关卡那的代码,按照类似的格式可以继续写关卡的.呵呵.这个游戏技术含量不高.但是很费时间.毕竟是我做过的最大的游戏.做游戏完全是兴趣.所以没怎么去深学.导致游戏做得很烂~~~纯SDK

    下面是部分代码~~如果需要全部代码和程序的朋友可以到我百度空间里去下载~~~

    空间地址http://hi.baidu.com/yangcong121
    代码部分(由于实在太长.我只发CMainWindow.cpp的代码)


    #include windows.h
    #include "MyBitmap.h"
    #include "Right.h"
    #include "resource.h"
    #include "Build.h"
    #include "infomation.h"
    #pragma comment(lib,"Msimg32.lib" )
    ///////////////////////////////////////////////////////////////////////////////

    static int     iTickTrigger=0;         //在后面循环中起到一个缓冲作用
    int            iTickCout;
    int            speed=12;
    BOOL           stop=false;
    POINT          pt;
    POINT          pt1;
    bool           mousecleck=false;         //鼠标是否选种建筑
    HDC            GAMEDC;
    HBITMAP        GAMEBITMAP;
    HDC            GAMEDC1;
    HBITMAP        GAMEBITMAP1;
    HDC            GAMEDC2;
    HBITMAP        GAMEBITMAP2;
    HDC            TOOLDC;
    HDC            windowDC;
    int            toolnum;
    HDC            bulid;
    int            nowbuild=-1;                  //目前屏幕上有几个建筑
    CBuild         bu[60];
    int            k;
    CMyBitmap      foe[12]={1,1,1,1,1,1,1,1,1,1,1,1};
    int            help=0;
    Cinfomation    info;
    int            pp;
    int            money=1000;
    int            guanka[50],jishu=1;
    bool           kaiguan[50];            //关卡开关
    int            shengming=100;
    int            daojishi=10;
    int            ll;
    ///////////////////////////////////////////////////////////////////////////////
    void draw(HDC DC2,int x,int y);

    void tool(HDC DC2);
    void mousechange(int x ,int y);
    void drawinfo(HDC DC2,int x,int y);
    void checkinfo(HDC DC2,int x,int y);
    void story(HDC DC2,HDC windowDC,int &money);
    LRESULT CALLBACK WinSunProc(
       HWND hwnd,        // handle to window
       UINT uMsg,        // message identifier
       WPARAM wParam,    // first message parameter
       LPARAM lParam     // second message parameter
    );

    int WINAPI WinMain(
       HINSTANCE hInstance,        // handle to current instance
       HINSTANCE hPrevInstance,    // handle to previous instance
       LPSTR lpCmdLine,            // command line
       int nCmdShow                // show state
    )
    {
       
         WNDCLASS wndcls;
         wndcls.cbClsExtra=0;
         wndcls.cbWndExtra=0;
         wndcls.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);  
         wndcls.hInstance=hInstance;
         wndcls.lpfnWndProc=WinSunProc;
         wndcls.lpszClassName="firstgame";
         wndcls.lpszMenuName=NULL;
         wndcls.hCursor=LoadCursor(NULL,IDC_ARROW);
         wndcls.hIcon=LoadIcon(NULL,IDI_APPLICATION);
         wndcls.style=CS_HREDRAW | CS_VREDRAW;
         RegisterClass(&wndcls);

         HWND hwnd;
         hwnd=CreateWindow("firstgame","制作中......",WS_POPUPWINDOW|WS_CAPTION|WS_MINIMIZEBOX,300,0,645,510,NULL,NULL,hInstance,NULL);
         if(!hwnd)
         {
           return FALSE;
         }
         ShowWindow(hwnd,SW_SHOWNORMAL);
         UpdateWindow(hwnd);

    //////////////////////////////////////////////////////////////////////////////////////

    楼主 2015-12-24 10:56 回复

共有回帖数 0
  • 回 帖
  • 表情 图片 视频
  • 发表

登录直线网账号

Copyright © 2010~2015 直线网 版权所有,All Rights Reserved.沪ICP备10039589号 意见反馈 | 关于直线 | 版权声明 | 会员须知