experimentation with steam
I am really excited about pyweek, can't wait. I decided to flex my game makin' muscles and whip up some stuff yesterday. In the end the basis for a lunar lander type game via steam. Fly it around until steam runs out! Thankfully I have a different idea should steam be the choice.. something a bit more creative and unique (but its good to have had the chance to play with rendering a barebones particle system type steam cloud :)
(log in to comment)
Comments
Sure :)
This is for the steam. Call add_particle fore every steam cloud being shot out at pos in dir (2d vecs), and run render_steam on your render, to a SRCALPHA Surface.
class steamjet:
def __init__(self,pressure):
# Particle: (pos,dir,life)
self.particles = []
self.pressure = pressure
self.max_pressure = pressure
def add_particle(self,start,dir):
if self.pressure == 0: return
self.pressure -= 1
self.particles.append((start,(dir[0]+(1-random.random()*2),dir[1]+(1-random.random()*2)),1,random.randint(5,35)))
def tick(self):
i=0
for p in self.particles:
if p[2] > p[3]: self.particles.remove(p)
else: self.particles[i] = ((p[0][0]+p[1][0],p[0][1]+p[1][1]),\
(p[1][0]-random.random()*(p[1][0]/2),p[1][1]-random.random()*(p[1][1]/2)),\
p[2]+1,p[3])
i+=1
if len(self.particles) == 0:
return False
return True
def render_steam(self,m_surf):
for s in self.particles:
pygame.draw.circle(m_surf,(255,255,255,255-s[2]*6),s[0],s[2])
maybe more info is required: no secret library here, just a bunch of python hacked yesterday morning, and a cool little steam ball I drew in inkscape, SteamBoy style. Its 2d, if anyone wants the full thing: www.nikolajbaer.us/Files/steamball.tgz.
richard on
2006/03/22 21:01:
Could you give some info on the engine you used? Perhaps release the source?