游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1409|回复: 1

谁能讲解下:关于地图、屏幕、角色、鼠标他们之间的坐

[复制链接]

2

主题

6

帖子

12

积分

新手上路

Rank: 1

积分
12
发表于 2005-6-10 20:44:00 | 显示全部楼层 |阅读模式
在屏幕显示时表示不同的位置
有时候是要地块来表示,有时候又要用坐标来表示
最好能用图来说明
sf_2005610204426.bmp

2

主题

6

帖子

12

积分

新手上路

Rank: 1

积分
12
 楼主| 发表于 2005-6-10 20:55:00 | 显示全部楼层

Re:谁能讲解下:关于地图、屏幕、角色、鼠标他们之间的

//放入物体和角色///////////////////////////////////////////////////////////////////////////////
        m_MainRole.RoleFSM();
    for(y=ftop;y<fbottom;y++)
                //从地图上访开始读取
                for(x=fleft;x<fright;x++)
                        //从地图左边开始读取
                {
                        if(m_MapStruct.titlestruct[x][y].IsObjectKeyPos)
                                //如果有角色关键坐标
                        {
                                int ID=m_MapStruct.titlestruct[x][y].ObjectID;
                                int n=0;
                                while(ID!=m_Object.m_ObjectStruct[n].m_nID)
                                        n++;
                                m_lpDDSScene->BltFast((BACK_X+x-m_Object.m_ObjectStruct[n].m_pKeyPos.x)*TITLE_SIZE,
                                                          (BACK_Y+y-m_Object.m_ObjectStruct[n].m_pKeyPos.y)*TITLE_SIZE,
                                                                           m_Object.m_lpDDSObject[n],
                                                                           NULL,SrcKey);
                                //以黑色作为透明色将角色加入后台缓存??
                        }

                        //放入NPC角色
                        for(int h=0;h<m_nNPCRoleCount;h++)
                        {
                                if(m_NPCRole[h].m_Role.m_pPos.x/TITLE_SIZE==x
                                        &&m_NPCRole[h].m_Role.m_pPos.y/TITLE_SIZE==y)
                                {
                                        int rx=m_NPCRole[h].m_Role.m_pPos.x;
                                    int ry=m_NPCRole[h].m_Role.m_pPos.y;
                                    int kx=m_NPCRole[h].m_Role.m_rfstruct.m_pKeyPos.x;
                                    int ky=m_NPCRole[h].m_Role.m_rfstruct.m_pKeyPos.y;
                                        RECT rt;
                                        rt.left=m_NPCRole[h].Step*m_NPCRole[h].m_Role.m_rfstruct.m_nCellWidth;
                                        rt.top=m_NPCRole[h].m_Role.dir*m_NPCRole[h].m_Role.m_rfstruct.m_nCellHeight;
                                        rt.right=rt.left+m_NPCRole[h].m_Role.m_rfstruct.m_nCellWidth;
                                        rt.bottom=rt.top+m_NPCRole[h].m_Role.m_rfstruct.m_nCellHeight;
                                        m_lpDDSScene->BltFast(BACK_X*TITLE_SIZE+rx-kx,BACK_Y*TITLE_SIZE+ry-ky,
                                                                                  m_NPCRole[h].m_lpDDSRole,
                                          &rt,SrcKey);
                                }
                        }
                        //放入主角
                        if(m_MainRole.m_Role.m_pPos.x/TITLE_SIZE==x
                                &&m_MainRole.m_Role.m_pPos.y/TITLE_SIZE==y)
                        {
                                int rx=m_MainRole.m_Role.m_pPos.x;
                            int ry=m_MainRole.m_Role.m_pPos.y;
                            int kx=m_MainRole.m_Role.m_rfstruct.m_pKeyPos.x;
                            int ky=m_MainRole.m_Role.m_rfstruct.m_pKeyPos.y;
                                RECT rt;
                                rt.left=m_MainRole.Step*m_MainRole.m_Role.m_rfstruct.m_nCellWidth;
                                rt.top=m_MainRole.m_Role.dir*m_MainRole.m_Role.m_rfstruct.m_nCellHeight;
                                rt.right=rt.left+m_MainRole.m_Role.m_rfstruct.m_nCellWidth;
                                rt.bottom=rt.top+m_MainRole.m_Role.m_rfstruct.m_nCellHeight;
                                m_lpDDSScene->BltFast(BACK_X*TITLE_SIZE+rx-kx,BACK_Y*TITLE_SIZE+ry-ky,
                                                                          m_MainRole.m_lpDDSRole,
                                         &rt,SrcKey);
                        }

                }
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-12-25 23:08

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表