




下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
//////#include"CommonAPI.h"#include"LessonX.h"floatg_fSpeedLeft=0.f;//左方向速度floatg_fSpeedRight=0.f;//右floatg_fSpeedTop=0.f;//上floatg_fSpeedBottom=0.f;//下intN=0;///////////////////////////////////////////////////////////////////////////////////////////////主函數入口////////////////////////////////////////////////////////////////////////////////////////////intPASCALWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,LPSTRlpCmdLine,intnCmdShow){floatg_fScreenLeft=0.f;//屏幕左邊界值floatg_fScreenRight=0.f;//右floatg_fScreenTop=0.f;//上floatg_fScreenBottom=0.f;//下//初始化游戲引擎if(!dInitGameEngine(hInstance,lpCmdLine))return0;g_fScreenLeft=dGetScreenLeft();g_fScreenRight=dGetScreenRight();g_fScreenTop=dGetScreenTop();g_fScreenBottom=dGetScreenBottom();dSetSpriteWorldLimit("mdzz",WORLD_LIMIT_NULL,g_fScreenLeft,g_fScreenTop,g_fScreenRight,g_fScreenBottom);dSetSpriteWorldLimit("hhh",WORLD_LIMIT_NULL,g_fScreenLeft,g_fScreenTop,g_fScreenRight,g_fScreenBottom);dSetSpriteWorldLimit("poi",WORLD_LIMIT_NULL,g_fScreenLeft,g_fScreenTop,g_fScreenRight,g_fScreenBottom);dSetSpriteWorldLimit("yu_0",WORLD_LIMIT_NULL,g_fScreenLeft,g_fScreenTop,g_fScreenRight,g_fScreenBottom);dSetSpriteWorldLimit("haima",WORLD_LIMIT_NULL,g_fScreenLeft,g_fScreenTop,g_fScreenRight,g_fScreenBottom);//Todo:在此使用API更改窗口標題dSetWindowTitle("Lesson");//引擎主循環(huán),處理屏幕圖像刷新等工作while(dEngineMainLoop()){//獲取兩次調用之間的時間差,傳遞給游戲邏輯處理floatfTimeDelta=dGetTimeDelta();//執(zhí)行游戲主循環(huán)GameMainLoop(fTimeDelta);};//關閉游戲引擎dShutdownGameEngine();return0;}//==========================================================================////引擎捕捉鼠標移動消息后,將調用到本函數voiddOnMouseMove(constfloatfMouseX,constfloatfMouseY){//可以在此添加游戲需要的響應函數}//==========================================================================////引擎捕捉鼠標點擊消息后,將調用到本函數voiddOnMouseClick(constintiMouseType,constfloatfMouseX,constfloatfMouseY){while(N<3){dSetSpriteLinearVelocity("hhh",-10,18);dSetSpriteLinearVelocity("mdzz",-5,19);dSetSpriteLinearVelocity("yu_0",20,8);dSetSpriteLinearVelocity("haima",15,-9);N++;}//可以在此添加游戲需要的響應函數dSetSpriteLinearVelocity("poi",(g_fSpeedLeft+g_fSpeedRight)*3,(g_fSpeedTop+g_fSpeedBottom)*3);}//==========================================================================////引擎捕捉鼠標彈起消息后,將調用到本函數voiddOnMouseUp(constintiMouseType,constfloatfMouseX,constfloatfMouseY){//可以在此添加游戲需要的響應函數}//==========================================================================////引擎捕捉鍵盤按下消息后,將調用到本函數//iAltPressiShiftPressiCtrlPress分別為判斷Shift,Alt,Ctrl當前是否也處于按下狀態(tài)。比如可以判斷Ctrl+E組合鍵voiddOnKeyDown(constintiKey,constintiAltPress,constintiShiftPress,constintiCtrlPress){switch(iKey){caseKEY_W:g_fSpeedTop=-10.f;break;caseKEY_A:g_fSpeedLeft=-15.f;break;caseKEY_S:g_fSpeedBottom=10.f;break;caseKEY_D:g_fSpeedRight=15.f;break;default:break;}dSetSpriteLinearVelocity("poi",g_fSpeedLeft+g_fSpeedRight,g_fSpeedTop+g_fSpeedBottom);if((g_fSpeedLeft+g_fSpeedRight)>0.f)dSetSpriteFlipX("poi",false);elseif((g_fSpeedLeft+g_fSpeedRight)<0.f)dSetSpriteFlipX("poi",true);//可以在此添加游戲需要的響應函數}//==========================================================================////引擎捕捉鍵盤彈起消息后,將調用到本函數voiddOnKeyUp(constintiKey){switch(iKey){caseKEY_W:g_fSpeedTop=0.f;break;caseKEY_A:g_fSpeedLeft=0.f;break;caseKEY_S:g_fSpeedBottom=0.f;break;caseKEY_D:g_fSpeedRight=0.f;break;}dSetSpriteLinearVelocity("poi",g_fSpeedLeft+g_fSpeedRight,g_fSpeedTop+g_fSpeedBottom);if((g_fSpeedLeft+g_fSpeedRight)>0.f)dSetSpriteFlipX("poimyfish",false);elseif((g_fSpeedLeft+g_fSpeedRight)<0.f)dSetSpriteFlipX("poi",true);//可以在此添加游戲需要的響應函數}//===========================================================================////引擎捕捉到精靈與精靈碰撞之后,調用此函數voiddOnSpriteColSprite(constchar*szSrcName,constchar*szTarName){}//===========================================================================////引擎捕捉到精靈與世界邊界碰撞之后,調用此函數.//iColSide:0左邊,1右邊,2上邊,3下邊voiddOnSpriteColWorldLimit(constchar*szName,constintiColSide){if(strcmp(szName,"poi")==0)dSetSpriteLinearVelocity("poi",0,0);if(strcmp(szName,"yu_0")==0){if(iColSide==1)//右邊{dSetSpriteFlipX("yu_0",true);dSetSpriteLinearVelocity("yu_0",-15,5);}elseif(iColSide==0)//左邊{dSetSpriteFlipX("yu_0",false);dSetSpriteLinearVelocity("yu_0",10,-18);}elseif(iColSide==2)//上邊{dSetSpriteLinearVelocity("yu_0",15,8);}elseif(iColSide==3)//下邊{dSetSpriteLinearVelocity("yu_0",-19,-10);}}if(strcmp(szName,"haima")==0)////haima{if(iColSide==1)//右邊{dSetSpriteFlipX("haima",true);dSetSpriteLinearVelocity("haima",-20,5);}elseif(iColSide==0)//左邊{dSetSpriteFlipX("haima",false);dSetSpriteLinearVelocity("haima",15,6);}elseif(iColSide==2)//上邊{dSetSpriteLinearVelocity("haima",10,6);}elseif(iColSide==3)//下邊{dSetSpriteLinearVelocity("haima",10,-6);}}if(strcmp(szName,"mdzz")==0)////haima{if(iColSide==1)//右邊{dSetSpriteFlipX("mdzz",true);dSetSpriteLinearVelocity("mdzz",-10,10);}elseif(iColSide==0)//左邊{dSetSpriteFlipX("mdzz",false);dSetSpriteLinearVelocity("mdzz",12,8);}elseif(iColSide==2)//上邊{dSetSpriteLinearVelocity("mdzz",10,11);}elseif(iColSide==3)//下邊{dSetSpriteLinearVelocity("mdzz",10,-9);}}if(strcmp(szName,"hhh")==0)////haima{if(iColSide==1)//右邊{dSetSpriteFlipX("hh
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 高性能復合材料研發(fā)與生產項目合作有限合伙協議
- 基于激光超聲的玉米品質檢測方法研究
- 抖音與汽車行業(yè)聯合營銷合作協議
- 中國鄉(xiāng)土文化的試題及答案回顧
- 護理責任與義務試題及答案
- 知識產權分割與知識產權授權合作協議
- 影視動畫渲染工作室租賃及效果優(yōu)化合同
- 綠色建筑節(jié)能改造項目效益共享合同
- 對于民俗文化的社會功能分析與試題及答案
- 2025年農林、畜牧用金屬工具項目申請報告
- 2024年臺州市委統(tǒng)戰(zhàn)部下屬事業(yè)單位選聘筆試真題
- 山西太原事業(yè)單位考試《行測》模擬題帶答案2024年
- 2025年中考英語第一次模擬考試(蘇州卷)(原卷版)
- 福州一號線盾構法地鐵工程整體施工組織設計
- 公務員考試-經濟基礎知識模擬題-計量經濟學-協整與誤差修正模型
- 資源與運營管理-第一次形考任務-國開-參考資料
- 五年級下冊數學教案 - 8.1《復式條形統(tǒng)計圖》 北師大版
- 2025年二建《建筑工程管理與實務》考前必刷必練題庫500題(含真題、重點題)
- 2025云南師范大學輔導員考試題庫
- 學生健康檔案管理制度
- Unit 7 A Day to Remember Section A (課件)-2024-2025學年英語人教版7年級下冊
評論
0/150
提交評論