1、罗培羽教你制作3DRPG游戏,罗培羽 作品,E_mail: QQ:345697666 网名:碧俐千仞,第三节 Interface,标题画面,背景新游戏 旧游戏 离开游戏,标题画面,放到目录下,标题画面,panel mytitle/标题画面pos_x = 0;pos_y = 0;layer = 1;bmap = mytitle.pcx;alpha=100;flags = refresh; ,标题画面,starter start_up() d3d_autotransparency = 1; video_switch(7,32,2); level_load(level_1); sky_clip =
2、0; media_loop(“pal3.mp3“,null,200); mytitle.visible=on; while(myplayer=null)wait(1); ,按钮,标题画面,button = 横坐标, 纵坐标, 点击图片, b平常图片,鼠标放上图片, 鼠标点击函数, 平常函数,鼠标放上函数;,标题画面,panel mytitle/标题画面pos_x = 0;pos_y = 0;layer = 1;bmap = mytitle.pcx;alpha=100;flags = overlay,refresh;button = 50, 500, b11.pcx,b1.pcx,b11.pcx
3、, null, null, null;button = 150, 500, b22.pcx,b2.pcx,b22.pcx, null, null, null;button = 250, 500, b33.pcx,b3.pcx,b33.pcx, null, null, null; ,标题画面,鼠标移到按钮上,没反应?,标题画面,mytitle.visible=on; while(myplayer=null)wait(1);while(1)/标题循环 mouse_pos.x=mouse_cursor.x;mouse_pos.y=mouse_cursor.y;wait(1); ,标题画面,鼠标图标?
4、bmap myarrow = ;/鼠标图片mouse_map=myarrow;,标题画面,Mouse_mode=1;,标题画面,函数,标题画面,离开 Function2.wdl include;,标题画面,function leave() exit; ,标题画面,button = 50, 500, b11.pcx,b1.pcx,b11.pcx, null, null, null;button = 150, 500, b22.pcx,b2.pcx,b22.pcx, null, null, null;button = 250, 500, b33.pcx,b3.pcx,b33.pcx, leave(
5、), null, null;,标题画面,新的游戏 var ctrlable = 0; while(ctrlable=0)/标题画面 mouse_pos.x=mouse_cursor.x;mouse_pos.y=mouse_cursor.y;wait(1); ,标题画面,function newgame() mytitle.visible=off;mouse_map=null;ctrlable=1; ,标题画面,button = 50, 500, b11.pcx,b1.pcx,b11.pcx, newgame(), null, null;button = 150, 500, b22.pcx,b2
6、.pcx,b22.pcx, null, null, null;button = 250, 500, b33.pcx,b3.pcx,b33.pcx, leave(), null, null;,标题画面,旧的游戏保存 game_save(“save“,0,SV_ALl);读取 game_load(“save“,0);,标题画面,function oldgame() game_load(“save“,0); ,标题画面,button = 50, 500, b11.pcx,b1.pcx,b11.pcx, newgame(), null, null;button = 150, 500, b22.pcx,
7、b2.pcx,b22.pcx, oldgame(), null, null;button = 250, 500, b33.pcx,b3.pcx,b33.pcx, leave(), null, null;,菜单界面,菜单界面,定义太混乱! 添加 dim.wdl 剪切代码 include;,菜单界面,panel mymenu/菜单画面pos_x = 0;pos_y = 0;layer = 1;bmap = mymenu.pcx;alpha=100;flags = overlay,refresh;button = 50, 500, b44.pcx,b4.pcx,b44.pcx, null, null
8、, null;button = 150, 500, b55.pcx,b5.pcx,b55.pcx, null, null, null; ,菜单界面,Do_role 后面/菜单判断if(key_f1)menu();,菜单界面,function2.wdl function menu() mymenu.visible=on; ,菜单界面,function menu() ctrlable=0;mouse_map=myarrow;mymenu.visible=on; while(ctrlable=0)/菜单循环 mouse_pos.x=mouse_cursor.x;mouse_pos.y=mouse_c
9、ursor.y;wait(1); ,菜单界面,function goback() ctrlable=1;mymenu.visible=off;mouse_map=null; ,菜单界面,function save() game_save(“save“,0,SV_ALl);goback(); ,菜单界面,panel mymenu/菜单界面pos_x = 0;pos_y = 0;layer = 1;bmap = mymenu.pcx;alpha=100;flags = overlay,refresh;button = 50, 500, b44.pcx,b4.pcx,b44.pcx, save(),
10、 null, null;button = 150, 500, b55.pcx,b5.pcx,b55.pcx, goback(), null, null; ,菜单界面,function oldgame() game_load(“save“,0);goback(); ,菜单界面,var hp=300;,菜单界面,digits(横坐标, 纵坐标,显示格式, 显示字体, 系数, 变量);,菜单界面,font text_font2 = “Arial“,0,60; panel mymenu/菜单画面pos_x = 0;pos_y = 0;layer = 1;bmap = mymenu.pcx;alpha=
11、100;flags = overlay,refresh;button = 50, 500, b44.pcx,b4.pcx,b44.pcx, save(), null, null;button = 150, 500, b55.pcx,b5.pcx,b55.pcx, goback(), null, null;digits(80, 100,“生命:“, text_font2, 1, null);digits(140, 160, 3, text_font2, 1, hp); ,游戏结束界面,游戏结束界面,游戏结束界面,panel mygameover/游戏结束画面pos_x = 0;pos_y = 0;layer = 1;bmap = mygameover.pcx;alpha=100;flags = overlay,refresh;button = 650, 500, b33.pcx,b3.pcx,b33.pcx, leave(), null, null; ,游戏结束界面,function gameover() mouse_map=myarrow;mygameover.visible=on; while(1)/循环 mouse_pos.x=mouse_cursor.x;mouse_pos.y=mouse_cursor.y;wait(1); ,游戏结束界面,顺便调用试试,谢谢支持,