mirror of
				https://github.com/LDDestroier/CC/
				synced 2025-10-31 07:22:59 +00:00 
			
		
		
		
	Added animated flashing for WIN/LOSE/TIE images
This commit is contained in:
		
							
								
								
									
										20
									
								
								tron.lua
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								tron.lua
									
									
									
									
									
								
							| @@ -779,10 +779,19 @@ local sendInfo = function(gameID) | |||||||
| end | end | ||||||
|  |  | ||||||
| local waitForKey = function(time) | local waitForKey = function(time) | ||||||
| 	sleep(time or 0.1) | 	sleep(time or 0.5) | ||||||
| 	os.pullEvent("key") | 	os.pullEvent("key") | ||||||
| end | end | ||||||
|  |  | ||||||
|  | local imageAnim = function(image) | ||||||
|  | 	while true do | ||||||
|  | 		drawImage(image, mathceil(scr_x / 2 - image.x / 2), mathfloor(scr_y / 2 - image.y / 2)) | ||||||
|  | 		sleep(0.5) | ||||||
|  | 		render(true) | ||||||
|  | 		sleep(0.5) | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
| local deadAnimation = function(doSend) | local deadAnimation = function(doSend) | ||||||
| 	for k,v in pairs(deadGuys) do | 	for k,v in pairs(deadGuys) do | ||||||
| 		player[k].char = "X" | 		player[k].char = "X" | ||||||
| @@ -796,20 +805,17 @@ local deadAnimation = function(doSend) | |||||||
| 		if deadGuys[you] and deadGuys[nou] then | 		if deadGuys[you] and deadGuys[nou] then | ||||||
| 			scrollToPosition(player[nou].x, player[nou].y) | 			scrollToPosition(player[nou].x, player[nou].y) | ||||||
| 			scrollToPosition(player[you].x, player[you].y) | 			scrollToPosition(player[you].x, player[you].y) | ||||||
| 			drawImage(images.tie, mathceil(scr_x / 2 - images.tie.x / 2), mathfloor(scr_y / 2 - images.tie.y / 2)) | 			parallel.waitForAny(function() imageAnim(images.tie) end, waitForKey) | ||||||
| 			waitForKey(1) |  | ||||||
| 			return "end" | 			return "end" | ||||||
| 		else | 		else | ||||||
| 			if deadGuys[you] then | 			if deadGuys[you] then | ||||||
| 				scrollX, scrollY = player[nou].x - scr_x / 2, player[nou].y - scr_y / 2 | 				scrollX, scrollY = player[nou].x - scr_x / 2, player[nou].y - scr_y / 2 | ||||||
| 				scrollToPosition(player[you].x, player[you].y) | 				scrollToPosition(player[you].x, player[you].y) | ||||||
| 				drawImage(images.lose, mathceil(scr_x / 2 - images.lose.x / 2), mathfloor(scr_y / 2 - images.lose.y / 2)) | 				parallel.waitForAny(function() imageAnim(images.lose) end, waitForKey) | ||||||
| 				waitForKey(1) |  | ||||||
| 				return "end" | 				return "end" | ||||||
| 			elseif deadGuys[nou] then | 			elseif deadGuys[nou] then | ||||||
| 				scrollToPosition(player[nou].x, player[nou].y) | 				scrollToPosition(player[nou].x, player[nou].y) | ||||||
| 				drawImage(images.win, mathceil(scr_x / 2 - images.win.x / 2), mathfloor(scr_y / 2 - images.win.y / 2)) | 				parallel.waitForAny(function() imageAnim(images.win) end, waitForKey) | ||||||
| 				waitForKey(1) |  | ||||||
| 				return "end" | 				return "end" | ||||||
| 			end | 			end | ||||||
| 		end | 		end | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 LDDestroier
					LDDestroier