freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

匯編貪吃蛇課程設(shè)計附源碼-wenkub

2023-06-16 03:18:56 本頁面
 

【正文】 13h int 10h mov cl , 7 。設(shè)置圖形模式 640*480 call show_start_msg 。隨即數(shù)種子 5 鍵盤掃描碼: LEFT EQU 4Bh RIGHT EQU 4Dh UP EQU 48h DOWN EQU 50h QUIT EQU 01h SPACE EQU 39h main 函數(shù) 主函數(shù)首先加載定義好的數(shù)據(jù),設(shè)置圖形模式大小,調(diào)用顯示開始提示信息的函數(shù),中斷等待用戶按鍵輸入,判斷退出或開始游戲。速度 gameover db 0 。 。 3 程序流程圖 4 數(shù)據(jù)定義及重要函數(shù) 數(shù)據(jù)定義及鍵盤掃描碼 數(shù)據(jù)定義: Len db ? 。按了有效的方向鍵后,先確定蛇頭的位置然后蛇身體隨著蛇頭移動,圖形的實現(xiàn)是從蛇頭的新位置開始畫出蛇,這時由于沒有清屏的原因,原來蛇的位置和新蛇的位置相差一個單位,所以看起來蛇會多一節(jié)身體。蛇頭撞到食物,則食物被吃掉,蛇身體長度 +1,同時記 100 分,蛇的身子越吃越長,身子越長玩的難度就越大,如果蛇在移動中撞到墻或身體交叉蛇頭撞倒自己身體游戲結(jié)束。 2 程序設(shè)計 程序分析 程序初始化: 加載在數(shù)據(jù)段定義好相關(guān)的提示信息以及儲存蛇身的數(shù)組,主要是如何開始游戲的提示信息 蛇的移動: 程序的關(guān)鍵是表示蛇的圖形以及蛇的移動。 食物的產(chǎn)生: 通過一系列運算產(chǎn)生在要求范圍內(nèi)的的隨機數(shù),此時的隨機數(shù)便是隨即點,可以通過產(chǎn)生的隨即點的坐標(biāo)畫出隨即點,也就是食物了。蛇的長度 Body dw 200 dup(0) 。得分 snake_color db 0ah 。游戲結(jié)束標(biāo)記 Point db 0 。進入游戲,重新設(shè)置圖形模式,調(diào)用 rec, clear_area,getfood,run_sanke 函數(shù)分別打印邊框,初始化蛇,隨機食物,開始運動蛇。顯示開始提示信息 call show_title mov ah , 00h int 16h 。邊框顏色 mov si , 59 mov bx , 19 Init_snake 。設(shè)置光標(biāo) call SetGb 。顯示提示信息 lea bp , msg5 mov cx , 29 call Msg exit_loop: mov ah , 00h int 16h 。退出到 DOS main endp Run_snake 函數(shù) 蛇一開始默認(rèn)向右運動,當(dāng)按下空格鍵時游戲暫停,再按空格鍵游戲開始。 run_snake proc push ax push bx push cx push dx push si push di mov dx, 0005h call SetGb mov bl,white lea bp,msg6 mov cx,30 call Msg loop1: 7 call Delay mov al,1 cmp al,gameover jz stop mov bx , offset Body mov cx,0 mov cl,Len add bx,cx add bx,cx sub bx,2 A1: mov ax,[bx] mov [bx+2],ax sub bx,2 loop A1 addhead: mov bx , offset Body 。存入頭部 mov dx,0 。取到蛇尾 add bx , ax sub bx , 2 mov ax , [bx] mov cx,0 mov [bx],cx 8 mov dx,0 mov dl , ah mov si , dx mov dl , al mov di , dx sub Len,1 call clearcut mov bx , offset Body mov ax, [bx] mov dx,0 mov dl , ah mov si , dx mov dl , al mov di , dx call cutsnake jmp A3 A2: add Len,1 mov bx , offset Body mov ax, [bx] mov dx,0 mov dl , ah mov si , dx mov dl , al mov di , dx call cutsnake 。調(diào)用 cutfood 函數(shù),將隨機食物在顯示屏輸出 getfood proc push ax push bx push cx push dx push si push di M1: mov si,50 。置隨機數(shù)范圍(最大值 +1) call Rand 。乘象素值 add ax,topline mov dx,ax push dx mov ax,si 。如果沒有按鍵就繼續(xù) mov ah , 0 。往上移動 jz check_UP cmp ah , DOWN 。檢查是否反向 add bx , Direction jz check_nokey mov Direction , ax jmp check_nokey check_RIGHT: 11 mov ah , 1 。檢查是否反向 sub bl , 1 jz check_nokey mov Direction , ax jmp check_nokey check_DOWN: mov ah , 0 。蛇的長度 Body dw 200 dup(0) 。得分 snake_color db 0ah 。游戲結(jié)束標(biāo)記 Point db 0 。****************************************************************************************** 。每格寬 cut_y dw 3 。Greedy Snakes39。Game is over!39。ESC for back, Space for retry39。 39。設(shè)置圖形模式 640*480 call show_start_msg 。設(shè)置圖形模式 320*200,游戲在此模式下運行 mov al , 13h int 10h mov cl , 7 。初始化蛇 call getfood 。設(shè)置光標(biāo)位置 mov bl , white 。等待按鍵 cmp ah , QUIT jz start cmp ah , SPACE jz game_start jmp exit_loop 。****************************************************************************************** 。****************************************************************************************** SetGb proc near push ax push bx mov bh , 0 mov ah , 02h int 10h pop bx pop ax ret SetGb endp 。傳遞參數(shù) : 。 dh/dl 行 /列 。函數(shù)名 : show_title 。函數(shù)名 : show_start_msg 。顯示作者信息 mov cx,11 call Msg 。顯示字符串 pop dx pop cx pop bx pop ax ret show_start_msg endp 。傳遞參數(shù) : 。取坐標(biāo)值 21 mul cut_y 。乘象素值 add ax,leftline 。函數(shù)名 : cutfood 。函數(shù)返回 : 空 。乘象素值 add ax,topline 。加上邊界 mov si , ax add ax , 3 mov di , ax pop dx pop bx call Rec 。功能 : 清除格 。****************************************************************************************** clearcut proc near push ax push bx push cx push dx push si push di mov cl , 0 。加上邊界 mov bx , ax 23 add ax , 2 mov dx , ax push bx push dx mov ax,si 。Rec 的參數(shù)是 cl顏色 si左邊 bx上邊 di右邊 dx下邊 pop di pop si pop dx pop cx pop bx pop ax ret clearcut endp 。傳遞參數(shù) : si 數(shù)字的范圍最大值 +1 。****************************************************************************************** 。****************************************************************************************** getfood proc push ax push bx push cx push dx push si push di M1: mov si,50 。置隨機數(shù)范圍(最大值 +1) call Rand 。乘象素值 add ax,topline mov dx,ax push dx mov ax,si 。****************************************************************************************** 。****************************************************************************************** 。****************************************************************************************** Check_key proc push ax push bx push cx push dx push si 26 push di mov ah , 01h int 16h jz check_nokey 。往右邊移動 jz check_RIGHT cmp ah , UP 。(1,0) mov al , 0 mov bx , ax 。(0,1) mov al , 1 mov bx , Direction 。按下 ESC鍵的情況 mov gameover,1 check_nokey: m
點擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1