ImageVerifierCode 换一换
格式:DOCX , 页数:114 ,大小:45.48KB ,
资源ID:10020828      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/10020828.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(超级玛丽增强版源代码.docx)为本站会员(b****7)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

超级玛丽增强版源代码.docx

1、超级玛丽增强版源代码/bitmaptool.hifndef _BITMAPTOOLdefine _BITMAPTOOLinclude ”filereport.h”#define BM_BOTTOM_RIGHT 0define BM_BOTTOM_CENTER 1define BM_CENTER 2define BM_USER 3/class MYBITMAPpublic: MYBITMAP(); MYBITMAP(); /初始化 void Init(HINSTANCE hInstance,int iResource,int row,int col); void SetDevice(HDC hd

2、est,HDC hsrc,int wwin,int hwin); / void SetPos(int istyle,int x,int y); /显示 void Draw(DWORD dwRop); void Stretch(int x,int y); void Stretch(int x,int y,int id); void Show(int x,int y); void ShowCenter(int y); void ShowLoop(int left,int top,int right,int bottom,int iframe); void ShowNoBack(int x,int

3、y,int iFrame); void ShowNoBackLoop(int x,int y,int iFrame,int iNum); /动画播放 void ShowAni(); void SetAni(int x,int y); / FILEREPORT f; HBITMAP hBm;public: /按照行列平均分成几个 int inum; int jnum; int width; int height; int screenwidth; int screenheight; HDC hdcdest; HDC hdcsrc; /当前位置 int xpos; int ypos; int iS

4、tartAni;;class MYBKSKY:public MYBITMAPpublic: MYBKSKY(); MYBKSKY(); /show void DrawRoll(); /循环补空 void DrawRollStretch(int x,int y); void DrawRollStretch(int x,int y,int id); void MoveTo(int x,int y); void MoveRoll(int x); /data int xseparate;#define BM_SQUARE 1class MYANIOBJ:public MYBITMAPpublic: M

5、YANIOBJ(); MYANIOBJ(); /init list void InitAniList(int pw,int ph,int inum,int ismask); void InitAniList(int style,int a,int b); /show void DrawItem(int x,int y,int id,int iframe); void DrawItemNoMask(int x,int y,int id,int iframe); /指定宽度 void DrawItemNoMaskWidth(int x,int y,int id,int w,int iframe);

6、 /自动播放 void PlayItem(int x,int y,int id); / int wlist20; int hlist20; int ylist20; int iframeplay;class MYANIMAGIC:public MYBITMAPpublic: MYANIMAGIC(); MYANIMAGIC(); /init list void InitAniList(int *pw,int *ph,int inum); void SetDevice(HDC hdest,HDC hsrc,HDC htemp); /show void DrawItem(int x,int y,i

7、nt id,int iframe); / int wlist20; int hlist20; int ylist20; HDC hdctemp;class MYROLE:public MYBITMAPpublic: MYROLE(); MYROLE(); /init void InitRole(int xleft, int xright); void SetLimit(int xleft, int xright); /show void Draw(); void Draw(int x,int y,int iframe); void ChangeFrame(); void SetState(in

8、t i); void Move(); void Jump(); /ANI void MoveTo(int x,int y); void MoveOffset(int x,int y); void MoveStepTo(int x,int y);/向目的地移动单位距离 void PlayAni();/播放一段动画 void SetAni(int istyle); int IsInAni();/是否正在播放动画 /data int iState; int iFrame; int minx; int maxx; /move int movex; int movey; / jump int jumph

9、eight; int jumpx; /方向 int idirec; /动画 int iAniBegin; int iparam1; int iAniStyle;;endif/ bitmaptool.cpp/ Finishing codefans。net#include stdafx.h”#include bitmaptool.hinclude ”gamemap。hextern GAMEMAP gamemap;extern FILEREPORT f1;MYBITMAP::MYBITMAP()MYBITMAP::MYBITMAP() DeleteObject(hBm);void MYBITMAP:

10、Init(HINSTANCE hInstance,int iResource,int row,int col) BITMAP bm; inum=row; jnum=col; hBm=LoadBitmap(hInstance,MAKEINTRESOURCE(iResource)); GetObject(hBm,sizeof(BITMAP),&bm); width=bm.bmWidth/inum; height=bm.bmHeight/jnum;void MYBITMAP:SetDevice(HDC hdest,HDC hsrc,int wwin,int hwin) hdcdest=hdest;

11、hdcsrc=hsrc; screenwidth=wwin; screenheight=hwin;void MYBITMAP:Show(int x,int y) xpos=x; ypos=y; SelectObject(hdcsrc,hBm); BitBlt(hdcdest,xpos,ypos,width,height,hdcsrc,0,0,SRCCOPY); void MYBITMAP:ShowCenter(int y) xpos=(screenwidth-width)/2; ypos=y; SelectObject(hdcsrc,hBm); BitBlt(hdcdest,xpos,ypos

12、,width,height,hdcsrc,0,0,SRCCOPY); void MYBITMAP::ShowLoop(int left,int top,int right,int bottom,int iframe) int i,j; SelectObject(hdcsrc,hBm); for(j=top;jbottom;j+=height) for(i=left;iright;i+=width) BitBlt(hdcdest,i,j,width,height,hdcsrc,iframe*width,0,SRCCOPY); void MYBITMAP::ShowNoBack(int x,int

13、 y,int iFrame) xpos=x; ypos=y; SelectObject(hdcsrc,hBm); BitBlt(hdcdest,xpos,ypos,width,height/2,hdcsrc,iFrame*width,height/2,SRCAND); BitBlt(hdcdest,xpos,ypos,width,height/2,hdcsrc,iFrame*width,0,SRCPAINT); void MYBITMAP::ShowNoBackLoop(int x,int y,int iFrame,int iNum) int i; xpos=x; ypos=y; Select

14、Object(hdcsrc,hBm); for(i=0;iiNum;i+) BitBlt(hdcdest,xpos+i*width,ypos,width,height/2,hdcsrc,iFrame*width,height/2,SRCAND); BitBlt(hdcdest,xpos+i*width,ypos,width,height/2,hdcsrc,iFramewidth,0,SRCPAINT); void MYBITMAP:ShowAni()/ if(!iStartAni) return; SelectObject(hdcsrc,hBm); BitBlt(hdcdest,xpos,yp

15、os,width,height/2,hdcsrc,framenowwidth,height/2,SRCAND); BitBlt(hdcdest,xpos,ypos,width,height/2,hdcsrc,framenow*width,0,SRCPAINT); framenow+; /播放结束 if(framenow=inum) iStartAni=0; /void MYBITMAP:SetAni(int x,int y) xpos=x; ypos=y; /* framenow=0; iStartAni=1; /void MYBITMAP::SetPos(int istyle,int x,i

16、nt y) switch(istyle) case BM_CENTER: xpos=(screenwidthwidth)/2; ypos=y; break; case BM_USER: xpos=x; ypos=y; break; void MYBITMAP::Draw(DWORD dwRop) SelectObject(hdcsrc,hBm); BitBlt(hdcdest,xpos,ypos,width,height,hdcsrc,0,0,dwRop); void MYBITMAP:Stretch(int x,int y) SelectObject(hdcsrc,hBm); Stretch

17、Blt(hdcdest,xpos,ypos,widthx,heighty, hdcsrc,0,0,width,height, SRCCOPY); void MYBITMAP::Stretch(int x,int y,int id) SelectObject(hdcsrc,hBm); StretchBlt(hdcdest,xpos,ypos,width*x,height*y, hdcsrc,0,id*height, width,height, SRCCOPY); / bitmap object animation/MYBKSKY::MYBKSKY() xseparate=0;MYBKSKY::M

18、YBKSKY()void MYBKSKY:MoveTo(int x,int y) xpos=x; ypos=y;void MYBKSKY:MoveRoll(int x) xseparate+=x; xseparate=width; if(xseparate0) xseparate=width; void MYBKSKY:DrawRoll() SelectObject(hdcsrc,hBm); BitBlt(hdcdest,xpos,ypos, widthxseparate,height, hdcsrc,xseparate,0,SRCCOPY); BitBlt(hdcdest,xpos+widt

19、h-xseparate,ypos, xseparate,height, hdcsrc,0,0,SRCCOPY); void MYBKSKY::DrawRollStretch(int x,int y) SelectObject(hdcsrc,hBm); StretchBlt(hdcdest,xpos,ypos, (width-xseparate)x,height*y, hdcsrc,xseparate,0, widthxseparate,height, SRCCOPY); StretchBlt(hdcdest,xpos+(width-xseparate)*x,ypos, xseparate*x,

20、height*y, hdcsrc,0,0, xseparate,height, SRCCOPY); void MYBKSKY::DrawRollStretch(int x,int y, int id) SelectObject(hdcsrc,hBm); StretchBlt(hdcdest,xpos,ypos, (width-xseparate)*x,heighty, hdcsrc,xseparate,id*height, widthxseparate,height, SRCCOPY); StretchBlt(hdcdest,xpos+(width-xseparate)x,ypos, xsep

21、arate*x,heighty, hdcsrc,0,idheight, xseparate,height, SRCCOPY); / bitmap role/MYROLE::MYROLE()MYROLE:MYROLE()void MYROLE::MoveTo(int x,int y) xpos=x; ypos=y;void MYROLE::MoveOffset(int x,int y) if(x=0 & y=0) return; if(!gamemap.RoleCanMove(x,y)) return; xpos+=x; ypos+=y; if(xposminx) xpos=minx; if(x

22、posmaxx) xpos=maxx; void MYROLE:MoveStepTo(int x,int y) if(xposx) xpos+=ROLE_STEP; if(ypos= JUMP_HEIGHT * 32) jumpheight = JUMP_HEIGHT * 32; movey=4; else if(movey0) jumpheight = movey; /根据重力影响,加速度增大 movey+; void MYROLE::Jump() /上升过程 MoveOffset(0, 4);void MYROLE::ChangeFrame()void MYROLE::SetState(i

23、nt i) iState=i;void MYROLE:SetAni(int istyle) iAniStyle=istyle; iparam1=0; iAniBegin=1;/是否正在播放动画int MYROLE::IsInAni() return iAniBegin;void MYROLE::PlayAni() switch(iAniStyle) case ROLE_ANI_DOWN: if(iparam131) break; /人物下降动画 SelectObject(hdcsrc,hBm); BitBlt(hdcdest, xpos,ypos+iparam1, width,height/2

24、-iparam1, hdcsrc, iFramewidth,height/2,SRCAND); BitBlt(hdcdest, xpos,ypos+iparam1, width,height/2iparam1, hdcsrc, iFramewidth,0,SRCPAINT); iparam1+; break; case ROLE_ANI_UP: if(iparam131) break; /人物上升动画 SelectObject(hdcsrc,hBm); BitBlt(hdcdest, xpos,ypos+32-iparam1, width,iparam1, hdcsrc, iFramewidth,height/2,SRCAND); BitBlt(hdcdest, xpos,ypos+32iparam1, width,iparam1, hdcsrc, iFr

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1