| |||||||||||
PyWeek - experimentation with steamI 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 :)
— nikolajbaer on 2006/03/22 18:24 of Nik Baer's Solo Entry Comments: (log in to comment) |
Last Challenge
September 2008 [entries, ratings] Previous March 2008 [entries, ratings] September 2007 [entries, ratings] April 2007 [entries, ratings] September 2006 [entries, ratings] > March 2006 [entries, ratings] (June 2006) August 2005 [entries, ratings] Not logged in Login | ||||||||||
By richard on 2006/03/22 21:01:
Could you give some info on the engine you used? Perhaps release the source?By nikolajbaer on 2006/03/22 21:45:
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])By nikolajbaer on 2006/03/22 22:03:
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.