📄 msc.asm
字号:
mov P_isDead,TRUE
invoke InvalidateRect,hWnd,addr deadRect,TRUE
mov eax,P_Zealot.xPos ; Zealot消失
sub eax,P_Zealot.speed
mov T_updateRect.left,eax
add eax,48
mov T_updateRect.right,eax
mov eax,P_Zealot.yPos
sub eax,P_Zealot.speed
mov T_updateRect.top,eax
add eax,54
mov T_updateRect.bottom,eax
invoke InvalidateRect,hWnd,addr T_updateRect,TRUE
.endif
.endif
.endif
.if nextGate ; 第二关?
mov eax,P_Zealot2.xPos
mov edx,P_Zealot2.yPos
.if (destpoint.x>=eax)&&(destpoint.y>=edx)
add eax,24
add edx,30
.if (destpoint.x<=eax)&&(destpoint.y<=edx)&&P2_inRange
mov P2_isHit,TRUE ; Zealot2被击中
invoke MessageBeep,MB_ICONASTERISK
sub P_Zealot2.life,1
mov P2_isHit,0
.if P_Zealot2.life==0 ; 判断Zealot2死亡
mov P2_isDead,TRUE
invoke InvalidateRect,hWnd,addr deadRect,TRUE
mov eax,P_Zealot2.xPos ; Zealot2消失
sub eax,P_Zealot2.speed
mov T_updateRect.left,eax
add eax,48
mov T_updateRect.right,eax
mov eax,P_Zealot2.yPos
sub eax,P_Zealot2.speed
mov T_updateRect.top,eax
add eax,54
mov T_updateRect.bottom,eax
invoke InvalidateRect,hWnd,addr T_updateRect,TRUE
.endif
.endif
.endif
.endif
.if P_isDead && P2_isDead
mov gameOver,TRUE
jmp endcheck
.endif
sub destpoint.x,28
sub destpoint.y,28
invoke MoveProc,hWnd,T_Vulture,destpoint.x,destpoint.y ; 调用移动子程序
jmp endcheck
timer:
.if wParam==ID_TIMER1
mov eax,T_Vulture.xPos ; 判断Zealot是否在Vultrue射程
.if eax>=P_Zealot.xPos
sub eax,P_Zealot.xPos
.else
mov eax,P_Zealot.xPos
sub eax,T_Vulture.xPos
.endif
mov edx,T_Vulture.yPos
.if edx>=P_Zealot.yPos
sub edx,P_Zealot.yPos
.else
mov edx,P_Zealot.yPos
sub edx,T_Vulture.yPos
.endif
.if eax<=T_Vulture.range && edx<=T_Vulture.range
mov P_inRange,TRUE
.else
mov P_inRange,0
.endif
.if nextGate ; 第二关?
mov eax,T_Vulture.xPos ; 判断Zealot是否在Vultrue射程
.if eax>=P_Zealot2.xPos
sub eax,P_Zealot2.xPos
.else
mov eax,P_Zealot2.xPos
sub eax,T_Vulture.xPos
.endif
mov edx,T_Vulture.yPos
.if edx>=P_Zealot2.yPos
sub edx,P_Zealot2.yPos
.else
mov edx,P_Zealot2.yPos
sub edx,T_Vulture.yPos
.endif
.if eax<=T_Vulture.range && edx<=T_Vulture.range
mov P2_inRange,TRUE
.else
mov P2_inRange,0
.endif
.endif
.if !T_isArrive && !T_isDead ; 循环移动
invoke MoveProc,hWnd,T_Vulture,destpoint.x,destpoint.y
.endif
.if !P_isArrive && !P_isDead && !gameOver
invoke MoveProc,hWnd,P_Zealot,T_Vulture.xPos,T_Vulture.yPos
.endif
.if !P2_isArrive && !P2_isDead && nextGate && !gameOver
invoke MoveProc,hWnd,P_Zealot2,T_Vulture.xPos,T_Vulture.yPos
.endif
.if (P_isArrive || P2_isArrive) && !T_isDead
sub T_Vulture.life,1
invoke MessageBeep,MB_ICONEXCLAMATION
.if T_Vulture.life==0 ; 判断Vulture死亡
mov T_isDead,TRUE
invoke InvalidateRect,hWnd,addr deadRect,TRUE
mov eax,T_Vulture.xPos ; Vulture消失
sub eax,T_Vulture.speed
mov T_updateRect.left,eax
add eax,96
mov T_updateRect.right,eax
mov eax,T_Vulture.yPos
sub eax,T_Vulture.speed
mov T_updateRect.top,eax
add eax,96
mov T_updateRect.bottom,eax
invoke InvalidateRect,hWnd,addr T_updateRect,TRUE
mov gameOver,TRUE
.endif
.endif
.elseif wParam==ID_TIMER2
jmp destroy
.elseif wParam==ID_TIMER3
invoke InvalidateRect,hWnd,NULL,TRUE
mov nextGate,TRUE ; 初始化
mov P_isDead,0
mov P_isArrive,0
mov P_Zealot.xPos,300
mov P_Zealot.yPos,20
mov P_Zealot.life,8
mov eax,hBitmapP2
mov P_Zealot.state,eax
mov T_isArrive,0
mov T_Vulture.xPos,360
mov T_Vulture.yPos,400
mov T_Vulture.life,5
mov eax,hBitmapT1
mov T_Vulture.state,eax
invoke KillTimer,hWnd,ID_TIMER3
.endif
jmp endcheck
WndProc endp
MoveProc proc hWnd:HWND,object:BROOD,destX:DWORD,destY:DWORD
.if object.nameId==ZEALOT2
add destX,56
add destY,56
.endif
mov eax,destX
mov edx,destY
.if (eax>=object.xPos)&&(edx<object.yPos) ; 判断目的地在哪个方向
jmp one
.elseif (eax<object.xPos)&&(edx<object.yPos)
jmp two
.elseif (eax<object.xPos)&&(edx>=object.yPos)
jmp three
.else
jmp four
.endif
one:
mov eax,destX
sub eax,object.xPos
mov T_disX,eax
mov eax,object.yPos
sub eax,destY
mov T_disY,eax
.if object.nameId==VULTURE
.if T_disX<eax
mov eax,object.speed
.if T_disY>eax
sub T_Vulture.yPos,eax
.endif
mov eax,T_disY
add T_disY,eax
mov eax,5
mul T_disX
mov T_disX,eax
.if eax<T_disY
mov eax,hBitmapT1
mov T_Vulture.state,eax
.else
mov eax,hBitmapT8
mov T_Vulture.state,eax
mov eax,object.speed
.if T_disX>eax
add T_Vulture.xPos,eax
.endif
.endif
.if T_disX<=100 && T_disY<=40
mov T_isArrive,TRUE
.endif
.else
mov eax,object.speed
.if T_disX>eax
add T_Vulture.xPos,eax
.endif
mov eax,T_disX
add T_disX,eax
mov eax,5
mul T_disY
mov T_disY,eax
.if eax<T_disX
mov eax,hBitmapT4
mov T_Vulture.state,eax
.else
mov eax,hBitmapT8
mov T_Vulture.state,eax
mov eax,object.speed
.if T_disY>eax
sub T_Vulture.yPos,eax
.endif
.endif
.if T_disX<=40 && T_disY<=100
mov T_isArrive,TRUE
.endif
.endif
.elseif object.nameId==ZEALOT
.if T_disX<eax
mov eax,object.speed
.if T_disY>eax
sub P_Zealot.yPos,eax
.endif
mov eax,T_disY
add T_disY,eax
mov eax,5
mul T_disX
mov T_disX,eax
.if eax<T_disY
mov eax,hBitmapP1
mov P_Zealot.state,eax
.else
mov eax,hBitmapP8
mov P_Zealot.state,eax
mov eax,object.speed
.if T_disX>eax
add P_Zealot.xPos,eax
.endif
.endif
.if T_disX<=60 && T_disY<=24
mov P_isArrive,TRUE
.endif
.else
mov eax,object.speed
.if T_disX>eax
add P_Zealot.xPos,eax
.endif
mov eax,T_disX
add T_disX,eax
mov eax,5
mul T_disY
mov T_disY,eax
.if eax<T_disX
mov eax,hBitmapP4
mov P_Zealot.state,eax
.else
mov eax,hBitmapP8
mov P_Zealot.state,eax
mov eax,object.speed
.if T_disY>eax
sub P_Zealot.yPos,eax
.endif
.endif
.if T_disX<=24 && T_disY<=60
mov P_isArrive,TRUE
.endif
.endif
.elseif object.nameId==ZEALOT2
.if T_disX<eax
mov eax,object.speed
.if T_disY>eax
sub P_Zealot2.yPos,eax
.endif
mov eax,T_disY
add T_disY,eax
mov eax,5
mul T_disX
mov T_disX,eax
.if eax<T_disY
mov eax,hBitmapP1
mov P_Zealot2.state,eax
.else
mov eax,hBitmapP8
mov P_Zealot2.state,eax
mov eax,object.speed
.if T_disX>eax
add P_Zealot2.xPos,eax
.endif
.endif
.if T_disX<=60 && T_disY<=24
mov P2_isArrive,TRUE
.endif
.else
mov eax,object.speed
.if T_disX>eax
add P_Zealot2.xPos,eax
.endif
mov eax,T_disX
add T_disX,eax
mov eax,5
mul T_disY
mov T_disY,eax
.if eax<T_disX
mov eax,hBitmapP4
mov P_Zealot2.state,eax
.else
mov eax,hBitmapP8
mov P_Zealot2.state,eax
mov eax,object.speed
.if T_disY>eax
sub P_Zealot2.yPos,eax
.endif
.endif
.if T_disX<=24 && T_disY<=60
mov P2_isArrive,TRUE
.endif
.endif
.endif
jmp update
two:
mov eax,object.xPos
sub eax,destX
mov T_disX,eax
mov eax,object.yPos
sub eax,destY
mov T_disY,eax
.if object.nameId==VULTURE
.if T_disX<eax
mov eax,object.speed
.if T_disY>eax
sub T_Vulture.yPos,eax
.endif
mov eax,T_disY
add T_disY,eax
mov eax,5
mul T_disX
mov T_disX,eax
.if eax<T_disY
mov eax,hBitmapT1
mov T_Vulture.state,eax
.else
mov eax,hBitmapT5
mov T_Vulture.state,eax
mov eax,object.speed
.if T_disX>eax
sub T_Vulture.xPos,eax
.endif
.endif
.if T_disX<=100 && T_disY<=40
mov T_isArrive,TRUE
.endif
.else
mov eax,object.speed
.if T_disX>eax
sub T_Vulture.xPos,eax
.endif
mov eax,T_disX
add T_disX,eax
mov eax,5
mul T_disY
mov T_disY,eax
.if eax<T_disX
mov eax,hBitmapT3
mov T_Vulture.state,eax
.else
mov eax,hBitmapT5
mov T_Vulture.state,eax
mov eax,object.speed
.if T_disY>eax
sub T_Vulture.yPos,eax
.endif
.endif
.if T_disX<=40 && T_disY<=100
mov T_isArrive,TRUE
.endif
.endif
.elseif object.nameId==ZEALOT
.if T_disX<eax
mov eax,object.speed
.if T_disY>eax
sub P_Zealot.yPos,eax
.endif
mov eax,T_disY
add T_disY,eax
mov eax,5
mul T_disX
mov T_disX,eax
.if eax<T_disY
mov eax,hBitmapP1
mov P_Zealot.state,eax
.else
mov eax,hBitmapP5
mov P_Zealot.state,eax
mov eax,object.speed
.if T_disX>eax
sub P_Zealot.xPos,eax
.endif
.endif
.if T_disX<=60 && T_disY<=24
mov P_isArrive,TRUE
.endif
.else
mov eax,object.speed
.if T_disX>eax
sub P_Zealot.xPos,eax
.endif
mov eax,T_disX
add T_disX,eax
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -