x86 - Assembly Game character movement slowing down my game -
i making game in assembly game being character object (in case 'x' char) moves dodge falling 0's , 1's. falling objects perfect problem i'm having if hold down direction either left or right falling objects stop accommodate player object's new position. i'm using irvine library procs such readkey gets keyboard input else 100% me. i'm not sure why stops complete line of code executed on first go through on print cycle. appreciated. below i'll post code. right runs on infinite loop broken if hit object.
;******* proc make easier reprint rain;kilian proc print proc mov esi,0 mov count, 0; intilize 0 reset print proc printall: mov ecx, count mov ebx , 0 cmp esi,4 je 4 jmp end4 four: mov esi , 4 end4: inloop2: mov dl,xarray[ebx] mov dh,yarray[ebx] call gotoxy ;moves cursor position of rain mov al,rainarray[ebx] call writechar ;rewrite rain push ecx cmp ebx, 0 je xmov jmp endx xmov: call readkey ; looks 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 character's current position ********* added version killian edited john mov dl , beginx call gotoxy mov al,'x' ;move x al ********* call writechar ;print ********** 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
this part of code doing heavy lifting problem in here somewhere. if see full code can go here git repo
the fix me putting calls readkey, rightif, , leftif down under print 'x' again code below:
endinloop: mov eax , 105 call delay call clrscr mov dh,23d ;move cursor character's current position ********* added version killian edited john mov dl , beginx call gotoxy mov al,'x' ;move x al ********* call writechar ;print ********** 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:
Comments
Post a Comment