moonbus: hot and cold particles
This commit is contained in:
		
							parent
							
								
									1f54a2f8f3
								
							
						
					
					
						commit
						ee5c2bb312
					
				
							
								
								
									
										15
									
								
								moonbus.p8
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								moonbus.p8
									
									
									
									
									
								
							| @ -130,7 +130,7 @@ function _update() | |||||||
|     if plr_engine != -1 then |     if plr_engine != -1 then | ||||||
|         sfx(2,2) |         sfx(2,2) | ||||||
|         plr_fuel=max(0,min(1,plr_fuel-fuel_cons)) |         plr_fuel=max(0,min(1,plr_fuel-fuel_cons)) | ||||||
|         generate_particle(plr_pos) |         generate_particle(true) | ||||||
|     else |     else | ||||||
|         sfx(-1,2) |         sfx(-1,2) | ||||||
|     end |     end | ||||||
| @ -207,10 +207,10 @@ function _update() | |||||||
|         plr_speed.x*=0.5 |         plr_speed.x*=0.5 | ||||||
|         plr_alive=false |         plr_alive=false | ||||||
|         if (dist(plr_speed) > 1) then |         if (dist(plr_speed) > 1) then | ||||||
|             for i=1,10 do generate_particle() end |             for i=1,10 do generate_particle(false) end | ||||||
|             sfx(0) |             sfx(0) | ||||||
|         else |         else | ||||||
|             for i=1,20 do generate_particle() end |             for i=1,20 do generate_particle(false) end | ||||||
|             plr_speed.x=0 |             plr_speed.x=0 | ||||||
|             plr_speed.y=0 |             plr_speed.y=0 | ||||||
|             plr_static=true |             plr_static=true | ||||||
| @ -275,7 +275,7 @@ function _draw() | |||||||
|         local p=part.p |         local p=part.p | ||||||
|         local px,py=to_scrn(p) |         local px,py=to_scrn(p) | ||||||
|         --pset(px,py,ttl > 10 and 8 or 5) |         --pset(px,py,ttl > 10 and 8 or 5) | ||||||
|         circ(px,py,cos(part.age/20)*0.6+1.5,part.age < 10 and 8 or (part.age < part.limit/2 and 5 or 1)) |         circ(px,py,cos(part.age/20)*0.6+1.5,part.age < 20 and 8 or (part.age < part.limit/2 and 5 or 1)) | ||||||
|     end |     end | ||||||
|     print(#particles, 32,50,11) |     print(#particles, 32,50,11) | ||||||
| 
 | 
 | ||||||
| @ -405,12 +405,13 @@ function next_target() | |||||||
|     plr_target={x=mp.x,y=maph-mp.y+1} |     plr_target={x=mp.x,y=maph-mp.y+1} | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function generate_particle() | function generate_particle(hot) | ||||||
|  |     hot=hot or false | ||||||
|     add(particles,{ |     add(particles,{ | ||||||
|         p=plus(plus(plr_pos,{x=0.25,y=-0.85}),{x=rnd(),y=rnd()},0.5), |         p=plus(plus(plr_pos,{x=0.25,y=-0.85}),{x=rnd(),y=rnd()},0.5), | ||||||
|         spd=plus(mul({x=rnd(2)-1,y=rnd(2)-1},0.1),mul(plr_speed,rnd(0.5))), |         spd=plus(mul({x=rnd(2)-1,y=rnd(2)-1},0.1),mul(plr_speed,rnd(0.5))), | ||||||
|         age=rnd(20), |         age=rnd(20) + (hot and 0 or 20), | ||||||
|         limit=80+flr(rnd(40)) |         limit=80+flr(rnd(40)) + (hot and 0 or 20) | ||||||
|     }) |     }) | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user