[Tetris] Fonction qui contrôle si un bloc peut tomber
Salut tout le monde
J'ai un petit souci avec la fonction qui contrôle si un bloc peut tomber. Est-ce que quelqu'un pourrait jeter un coup d’œil car elle ne fonctionne pas.
Pour ceux qui se demandent où j'en suis, voilà un lien avec mes fichiers. Je dois encore gérer les collisions et enlever une ligne si la ligne est remplie, enfin vous connaissez sûrement le jeu.
https://1drv.ms/f/s!Atvt3h2Eqlk0qF3E1iIt0Og2m4SR
Merci d'avance
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| PROC checkfall ; return eax if 1 not fallin if 0 falling
uses edi, esi, ecx, ebx
mov ebx, 0 ;ebx op nul zetten
mov eax, [dword ptr current_position] ;(current postitie +10 doen)
add eax, 10
mov edi, offset blockarray ; blockarray laden
add edi, eax ;goeie positie in blockarray
call returnBlockOffset ;eax de goeie blok laden
mov esi, eax ; in esi de blok steken
mov ch, 4
checkcolom:
mov cl, 4
checkline:
mov al, [esi] ;als block 0 is niks doen
jz nextpixel
mov ah, [edi] ; als array 0 is niks doen
jz nextpixel
mov ebx, 1 ; als blok en array niet nul zijn dan mag je niet vallen
mov cl, 0
jmp nextline
nextpixel:
inc edi
inc esi
dec cl
nextline:
cmp cl, 0
jne checkline
add edi, 6
dec ch
jnz checkcolom
mov eax, ebx
ret
ENDP checkfall
PROC fall
uses ebx
call checkfall
mov ebx, eax
cmp ebx, 1
je notfall
add [dword ptr current_position], 10
call returnBlockOffset
call drawblock, eax, [dword ptr current_position]
notfall:
ret
ENDP fall |