الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

انشاء لعبة ال "Tron" بواسطة لغة التجميع

بدأه sarah2010 في 21 نوفمبر 2011 · 0 رد · 959 مشاهدة · في أرشيف قسم الـــ Assembly
مشاركة: واتساب X فيسبوك تيليجرام
#1

السلام عليكم

لو سمحتم اريد مساعده في هذا البرنامج واللي فكرته تماما نفس هذا اللعبة

http://www.classicgamesarcade.com/game/21670/Tron-Game.html

المطلوب هو انشاء Tron وفي نهاية اللعبة تظهر النقاط لنا اللي حصلنا عليها من حركة هذا الجسم.

شروط اللعبة انه اذا هذا الحسم انصدم بنفسه او على اي حدود الصفح فان البرنامج ينتهي وتظهر لنا النقاط واذا ضغط الESC key اللعبة تنتهي واذا ضغط الSpace key البرنامج يتوقف للحضات واذا ضغط مره اخرى يقدر الاعب يواصل اللعبة. المفروض اني استخدم هذا البرنامج بواسطة اللمصفوفات حتى تذكر الموقع اللي كان فيه ال"Tron" وتنتهي اللعبة. طبعاً انا حاولت اللي اقدر عليه بس لعند المصفوفة ما عرفت كيف انشأها.

جزاكم الله خير

INCLUDE Irvine32.inc
INCLUDE Macros.inc
.data

;currentpos byte ?
del byte 100
col byte 39
row byte 13
socre BYTE 0 ;
tron BYTE 100 DUP(0)         

gameover byte "Game Over...",0
.code
main PROC

mov esi,offset tron 
mov eax, Yellow
call settextcolor

call randomize
mov eax,4

call randomrange 

cmp eax,0 
je loopr

cmp eax,1 
je loopl

cmp eax,2
je loopup

jmp loopdown

loopr:

		mgotoxy col,row	

		; to creat the row >
		mov al, 010h
		call WriteChar

		movzx eax,del 
		call delay

		mgotoxy col,row	
		mov al, 010h
		call writechar

		inc col

		cmp col,79
		jae done

		;if no key entered go to the right 
		call readkey
		jz loopr

		; if 'l' it will go to  the left... 
		cmp al, 'a'
		je loopl

		cmp al, 'y'
		je loopup

		cmp al,'b'
		je loopdown

		;if the esc key was intered then it will end the game		
		cmp al , 01bh
		je done
		;if the space key was hit
		cmp al, 020h
		call spacebar
		;jmp loopr
	; call Clrscr


loop loopr
;esc = al =1bh
;space = al =20h

loopl:

		mgotoxy col,row
		mov al,11h
		call writechar 

		movzx eax,del 
		call delay

		mgotoxy col,row

		mov al,11h 
		call writechar
		dec col

		cmp col,0
		jbe done 

		;if no key entered go to the right 
		call readkey
		jz loopl

		cmp al, 'l'
		je loopr

		cmp al, 'y'
		je loopup

		cmp al,'b'
		je loopdown

		;if the esc key was intered then it will end the game
		cmp al , 01bh
		je done
		cmp al, 020h
		call spacebar
 ;call Clrscr

loop loopl

loopup: 
		mgotoxy col,row
		mov al, 01Eh
		call writechar

		movzx eax, del
		call delay

		mgotoxy col,row
		mov al, 01Eh
		call writechar

		dec row


		cmp row,0
		jbe done

		;if no key entered go to the right 
		call readkey
		jz loopup

		cmp al, 'l'
		je loopr

		cmp al, 'a'
		je loopl

		cmp al,'b'
		je loopdown
		;if the esc key was intered then it will end the game
		cmp al , 01bh
		je done
		cmp al, 020h
		call spacebar
; call Clrscr

loop loopup

loopdown: 
		mgotoxy col,row
		mov al, 01fh
		call writechar

		movzx eax,del
		call delay

		mgotoxy col, row

		mov al, 01fh
		call writechar 

		inc row

		cmp row,24
		jge done

		;if no key entered go to the right 
		call readkey
		jz loopdown

		cmp al, 'l'
		je loopr

		cmp al, 'a'
		je loopl

		cmp al,'y'
		je loopup

		;if the esc key was intered then it will end the game
		cmp al , 01bh
		je done
		cmp al, 020h
		call spacebar
		;call Clrscr

loop loopdown 

done:

	 call Clrscr

	mov edx, offset gameover
	call writestring
;hold: 

;	call readkey
;	jz hold

exit	
main ENDP
;==============================================================================
spacebar proc 
;==============================================================================
hold: 

	call readkey
	jz hold
	ret

spacebar endp

END  main

تم تعديل هذه المشاركة بواسطة Xacker في 1 أغسطس 2012 في 13:42

مواضيع مشابهة