streak
This commit is contained in:
		
							parent
							
								
									87ddbff355
								
							
						
					
					
						commit
						c0743ba2c5
					
				
					 1 changed files with 30 additions and 8 deletions
				
			
		
							
								
								
									
										36
									
								
								toomgis.p8
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								toomgis.p8
									
									
									
									
									
								
							|  | @ -87,19 +87,16 @@ py = 0 | ||||||
| vx = 0 | vx = 0 | ||||||
| vy = 0 | vy = 0 | ||||||
| yacc = 0 | yacc = 0 | ||||||
|  | streak = 0 | ||||||
| 
 | 
 | ||||||
| function toomgis_radius() | function toomgis_radius() | ||||||
| 	return 8 + (pieces / MAX_PIECES) * 30 | 	return 8 + (pieces / MAX_PIECES) * 40 | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function add2body(n) | function add2body(n) | ||||||
| 	if pieces < MAX_PIECES then | 	if pieces < MAX_PIECES then | ||||||
| 		pieces += 1 | 		pieces += 1 | ||||||
| 		add(tbody, {n=n, r=toomgis_radius() + rnd(7), off=rnd(4)}) | 		add(tbody, {n=n, r=toomgis_radius() + rnd(9), off=rnd(4)}) | ||||||
| 	end |  | ||||||
| 	-- growth chomp every 10 |  | ||||||
| 	if pieces % 10 == 0 then  |  | ||||||
| 		sfx(6) |  | ||||||
| 	end | 	end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | @ -213,8 +210,28 @@ function level_draw() | ||||||
| 	-- hud | 	-- hud | ||||||
| 	local size = max(flr(pieces/MAX_PIECES*100), 1) | 	local size = max(flr(pieces/MAX_PIECES*100), 1) | ||||||
| 	local time_left = 10 | 	local time_left = 10 | ||||||
|  | 	local streak_str = streak2mult() | ||||||
|  | 	if streak_str == 1 then  | ||||||
|  | 		streak_str = "" | ||||||
|  | 	else | ||||||
|  | 		streak_str = streak_str.."X" | ||||||
|  | 	end | ||||||
| 	rectfill(0, 0, 128, 8, 2) | 	rectfill(0, 0, 128, 8, 2) | ||||||
| 	print("size "..size..lvl.unit.."     "..time_left.."S   ".."GOAL: 100"..lvl.unit, 1, 1, 9) | 	print("size "..size..lvl.unit.." "..streak_str.." ", 1, 1, 9) | ||||||
|  | 	print(time_left.."S", 70, 1, 9) | ||||||
|  | 	print("GOAL 100"..lvl.unit, 88, 1, 9) | ||||||
|  | end | ||||||
|  | 
 | ||||||
|  | function streak2mult() | ||||||
|  | 	if streak > 20 then | ||||||
|  | 		return 5 | ||||||
|  | 	elseif streak > 10 then  | ||||||
|  | 		return 3 | ||||||
|  | 	elseif streak > 5 then | ||||||
|  | 		return 2 | ||||||
|  | 	else | ||||||
|  | 		return 1 | ||||||
|  | 	end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function draw_stink(x, y) | function draw_stink(x, y) | ||||||
|  | @ -262,9 +279,14 @@ function level_upd() | ||||||
| 			if item.n > 16 then  | 			if item.n > 16 then  | ||||||
| 				sfx(5) | 				sfx(5) | ||||||
| 				hitbody() | 				hitbody() | ||||||
|  | 				streak = 0 | ||||||
| 			else | 			else | ||||||
|  | 				sfx(6) | ||||||
|  | 				for i=0,streak2mult() do | ||||||
| 					add2body(item.n) | 					add2body(item.n) | ||||||
| 				end | 				end | ||||||
|  | 				streak += 1 | ||||||
|  | 			end | ||||||
| 			item.n = 0 | 			item.n = 0 | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 James Turk
						James Turk