Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 集合游戏角色移动减慢我的游戏速度_Assembly_X86 - Fatal编程技术网

Assembly 集合游戏角色移动减慢我的游戏速度

Assembly 集合游戏角色移动减慢我的游戏速度,assembly,x86,Assembly,X86,我正在组装一个游戏,游戏是一个角色对象,在这种情况下,是“X”字符移动以躲避下降0和1。我的坠落物是完美的。我唯一的问题是,如果有人按住左或右的方向,我的坠落物就会停止,以适应玩家物体的新位置。我正在使用irvine库来处理程序,比如readkey,它可以获得键盘输入,其他的几乎都是100%的我。我不知道为什么它会停止一切来完成一行只在打印周期的第一次执行的代码。任何帮助都将不胜感激。下面我将发布代码。因为现在它运行在一个无限循环上,如果你被一个物体击中,这个循环就会被打破 ;*******

我正在组装一个游戏,游戏是一个角色对象,在这种情况下,是“X”字符移动以躲避下降0和1。我的坠落物是完美的。我唯一的问题是,如果有人按住左或右的方向,我的坠落物就会停止,以适应玩家物体的新位置。我正在使用irvine库来处理程序,比如readkey,它可以获得键盘输入,其他的几乎都是100%的我。我不知道为什么它会停止一切来完成一行只在打印周期的第一次执行的代码。任何帮助都将不胜感激。下面我将发布代码。因为现在它运行在一个无限循环上,如果你被一个物体击中,这个循环就会被打破

 ;******* proc to make it easier to reprint the rain;Kilian Proc

print PROC 


    mov esi,0
    mov count, 0; intilize as zero to reset the print proc

PrintAll: 




      mov ecx, count
    mov ebx , 0
    cmp esi,4
    je four
    jmp end4

four:
  mov esi , 4
end4:

inLoop2:

    mov dl,xArray[ebx]

    mov dh,yArray[ebx]
    call Gotoxy            ;Moves cursor to the position of rain


    mov al,rainArray[ebx]
    call WriteChar          ;Rewrite rain

    push ecx
    cmp ebx, 0
    je xmov
    jmp endx
xmov:
    call ReadKey          ; looks for keyboard input
     call RightIf
      call LeftIf
endx:   
    pop ecx
    call fall

    cmp ecx, 0
    jne decrease
    jmp endD
decrease:
    dec ecx
endD:
    inc ebx





    cmp ebx, esi
    ja endinLoop
    jmp inLoop2

endinLoop:

    mov eax , 105
    call delay
    call clrscr

    mov dh,23d              ;move cursor to character's current position ********* Added to this version by Killian edited by John
    mov dl , beginX
    call Gotoxy
    mov al,'X'              ;move X into al                               *********
    call WriteChar          ;print it                   **********
    call Crlf
    xor al,al               ;clear


    cmp ecx, 0
    je  random
    mov ebx, 0
    jmp inLoop2
random:

    mov eax, 5
    call RandomRange
    mov ebx, eax

    cmp ebx , 0
    je Increase
    jmp PrintAll


Increase:
    cmp esi, 4
    je PrintAll
    inc count
    inc esi 
    jmp PrintAll
EndPrint:

    ret
print       ENDP

代码的这一部分正在做所有的繁重工作,问题就在这里的某个地方。如果您想查看完整的代码,可以转到此处

我的解决方案是将对ReadKey、RightIf和LeftIf的调用放在下面,我在下面再次打印“X”代码:

 endinLoop:

    mov eax , 105
    call delay
    call clrscr

    mov dh,23d              ;move cursor to character's current position ********* Added to this version by Killian edited by John
    mov dl , beginX
    call Gotoxy
    mov al,'X'              ;move X into al                              *********
    call WriteChar          ;print it                   **********
    call Crlf
    xor al,al               ;clear

    push ecx
    call ReadKey
    call Rightif
    call Leftif
    pop ecx

    cmp ecx, 0
    je  random
    mov ebx, 0
    jmp inLoop2
random:

不管怎样,我解决了爱这个社区的问题;DIf如果您找到了解决方案,请将其作为答案发布,以便其他人也能找到:为了解决此问题,我将调用移动到了ReadKey、RightIf和LeftIf,并将其置于我再次打印“X”的区域下方。它很好地解决了这个问题。我将把代码放在下面。我不得不推ecx,因为我发现我的Rightif和Leftif区域改变了它的值,我需要保存它原来的值。