<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
	>
<channel>
	<title>Comments on: Pygame Starfield Rain</title>
	<atom:link href="http://www.scriptedfun.com/pygame-starfield-rain/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptedfun.com/pygame-starfield-rain/</link>
	<description>Game Programming for Beginners: Video Tutorials, Source Code, and Articles</description>
	<lastBuildDate>Mon, 18 May 2009 14:34:51 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Kamilche</title>
		<link>http://www.scriptedfun.com/pygame-starfield-rain/comment-page-1/#comment-975</link>
		<dc:creator>Kamilche</dc:creator>
		<pubDate>Thu, 26 Oct 2006 18:26:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptedfun.com/pygame-starfield-rain/#comment-975</guid>
		<description>Since the forum ate my spaces, here&#039;s a link to the smaller faster rain generator:

http://incarnation.danbo.com/ubbthreads/showflat.php?Cat=0&amp;Number=10483&amp;an=0&amp;page=0#Post10483
[url]http://incarnation.danbo.com/ubbthreads/showflat.php?Cat=0&amp;Number=10483&amp;an=0&amp;page=0#Post10483[/url]</description>
		<content:encoded><![CDATA[<p>Since the forum ate my spaces, here&#8217;s a link to the smaller faster rain generator:</p>
<p><a href="http://incarnation.danbo.com/ubbthreads/showflat.php?Cat=0&amp;Number=10483&amp;an=0&amp;page=0#Post10483" rel="nofollow">http://incarnation.danbo.com/ubbthreads/showflat.php?Cat=0&amp;Number=10483&amp;an=0&amp;page=0#Post10483</a><br />
[url]http://incarnation.danbo.com/ubbthreads/showflat.php?Cat=0&amp;Number=10483&amp;an=0&amp;page=0#Post10483[/url]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kamilche</title>
		<link>http://www.scriptedfun.com/pygame-starfield-rain/comment-page-1/#comment-974</link>
		<dc:creator>Kamilche</dc:creator>
		<pubDate>Thu, 26 Oct 2006 18:22:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptedfun.com/pygame-starfield-rain/#comment-974</guid>
		<description>I thought your rain generator was interesting. Here&#039;s a short version, that goes 10x faster, and still uses dirty rectangles. Enjoy!

import pygame
import random
import time

SCREENSIZE = 640, 480

class Rain(object):
    &#039; Rain generator&#039;
    drops = []
    height = 160
    speed = 1
    color = (255, 255, 255, 255)
    chance = .05
    
    def __init__(self, **kwargs):
        &#039; Allow programmer to change settings of rain generator&#039;
        self.__dict__.update(kwargs)
        
    def Render(self, screen):
        &#039; Render the rain&#039;
        dirtyrects = []
        for drop in self.drops:
            dr = drop.Render(dirtyrects, screen)
            
            if drop.dead:
                self.drops.remove(drop)
            dirtyrects.append(dr)
        if random.random()  self.maxy:
                self.dead = 1
            else:
                screen.blit(self.pic, self.pos)
            return r

def main():
    # Initialize pygame
    pygame.init()
    screen = pygame.display.set_mode(SCREENSIZE, 0, 32)

    # Create rain generator
    rain = Rain()

    # Main loop
    nexttime = time.time()
    ctr = 0
    quit = 0
    while not quit:

        # Uncomment the following line to make the rain go slower
        #time.sleep(.01)
        
        # Track FPS
        if time.time() &gt; nexttime:
            nexttime = time.time() + 1
            print &#039;%d fps&#039; % ctr
            ctr = 0
        ctr += 1

        # Draw rain
        screen.fill((0, 0, 0, 0))
        r = rain.Render(screen)

        # Look for user quit
        pygame.display.update(r)
        pygame.event.pump()
        for e in pygame.event.get():
            if e.type in [pygame.QUIT, pygame.KEYDOWN, pygame.MOUSEBUTTONDOWN]:
                quit = 1
                break

    # Terminate pygame
    pygame.quit()

if __name__ == &quot;__main__&quot;:
    main()</description>
		<content:encoded><![CDATA[<p>I thought your rain generator was interesting. Here&#8217;s a short version, that goes 10x faster, and still uses dirty rectangles. Enjoy!</p>
<p>import pygame<br />
import random<br />
import time</p>
<p>SCREENSIZE = 640, 480</p>
<p>class Rain(object):<br />
    &#8216; Rain generator&#8217;<br />
    drops = []<br />
    height = 160<br />
    speed = 1<br />
    color = (255, 255, 255, 255)<br />
    chance = .05</p>
<p>    def __init__(self, **kwargs):<br />
        &#8216; Allow programmer to change settings of rain generator&#8217;<br />
        self.__dict__.update(kwargs)</p>
<p>    def Render(self, screen):<br />
        &#8216; Render the rain&#8217;<br />
        dirtyrects = []<br />
        for drop in self.drops:<br />
            dr = drop.Render(dirtyrects, screen)</p>
<p>            if drop.dead:<br />
                self.drops.remove(drop)<br />
            dirtyrects.append(dr)<br />
        if random.random()  self.maxy:<br />
                self.dead = 1<br />
            else:<br />
                screen.blit(self.pic, self.pos)<br />
            return r</p>
<p>def main():<br />
    # Initialize pygame<br />
    pygame.init()<br />
    screen = pygame.display.set_mode(SCREENSIZE, 0, 32)</p>
<p>    # Create rain generator<br />
    rain = Rain()</p>
<p>    # Main loop<br />
    nexttime = time.time()<br />
    ctr = 0<br />
    quit = 0<br />
    while not quit:</p>
<p>        # Uncomment the following line to make the rain go slower<br />
        #time.sleep(.01)</p>
<p>        # Track FPS<br />
        if time.time() &gt; nexttime:<br />
            nexttime = time.time() + 1<br />
            print &#8216;%d fps&#8217; % ctr<br />
            ctr = 0<br />
        ctr += 1</p>
<p>        # Draw rain<br />
        screen.fill((0, 0, 0, 0))<br />
        r = rain.Render(screen)</p>
<p>        # Look for user quit<br />
        pygame.display.update(r)<br />
        pygame.event.pump()<br />
        for e in pygame.event.get():<br />
            if e.type in [pygame.QUIT, pygame.KEYDOWN, pygame.MOUSEBUTTONDOWN]:<br />
                quit = 1<br />
                break</p>
<p>    # Terminate pygame<br />
    pygame.quit()</p>
<p>if __name__ == &#8220;__main__&#8221;:<br />
    main()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: VxD</title>
		<link>http://www.scriptedfun.com/pygame-starfield-rain/comment-page-1/#comment-966</link>
		<dc:creator>VxD</dc:creator>
		<pubDate>Tue, 24 Oct 2006 10:38:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptedfun.com/pygame-starfield-rain/#comment-966</guid>
		<description>hehe, scriptfun may be the future community of game creators who share their codes and advices.. python/pygame is a language who permit this way.

good luck Chuck !</description>
		<content:encoded><![CDATA[<p>hehe, scriptfun may be the future community of game creators who share their codes and advices.. python/pygame is a language who permit this way.</p>
<p>good luck Chuck !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck</title>
		<link>http://www.scriptedfun.com/pygame-starfield-rain/comment-page-1/#comment-959</link>
		<dc:creator>Chuck</dc:creator>
		<pubDate>Sun, 22 Oct 2006 04:20:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptedfun.com/pygame-starfield-rain/#comment-959</guid>
		<description>Thanks for the suggestion, Dave. I might consider putting up a forum sometime in the future, but for now, I would like to focus my efforts on adding content to this site. Thank you again!</description>
		<content:encoded><![CDATA[<p>Thanks for the suggestion, Dave. I might consider putting up a forum sometime in the future, but for now, I would like to focus my efforts on adding content to this site. Thank you again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.scriptedfun.com/pygame-starfield-rain/comment-page-1/#comment-958</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Sat, 21 Oct 2006 20:20:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptedfun.com/pygame-starfield-rain/#comment-958</guid>
		<description>typing in comments like this is annoying. I think you should start a simple free forum. There is al ist of software here: http://thinkofit.com/webconf/forumsoft.htm</description>
		<content:encoded><![CDATA[<p>typing in comments like this is annoying. I think you should start a simple free forum. There is al ist of software here: <a href="http://thinkofit.com/webconf/forumsoft.htm" rel="nofollow">http://thinkofit.com/webconf/forumsoft.htm</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck</title>
		<link>http://www.scriptedfun.com/pygame-starfield-rain/comment-page-1/#comment-957</link>
		<dc:creator>Chuck</dc:creator>
		<pubDate>Sat, 21 Oct 2006 11:27:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptedfun.com/pygame-starfield-rain/#comment-957</guid>
		<description>The droplet&#039;s appearance is determined by the dropimage() function. To make the drop circular, you would probably have to change the line with the fill into this:

pygame.draw.circle(image, (255, 255, 255), (1, 1), 2)

Here, we use pygame&#039;s draw module to draw a white circle at the center of the &quot;droplet surface&quot; with radius 2, which should just about fill the &quot;droplet surface&quot;.

Hope this helps.</description>
		<content:encoded><![CDATA[<p>The droplet&#8217;s appearance is determined by the dropimage() function. To make the drop circular, you would probably have to change the line with the fill into this:</p>
<p>pygame.draw.circle(image, (255, 255, 255), (1, 1), 2)</p>
<p>Here, we use pygame&#8217;s draw module to draw a white circle at the center of the &#8220;droplet surface&#8221; with radius 2, which should just about fill the &#8220;droplet surface&#8221;.</p>
<p>Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.scriptedfun.com/pygame-starfield-rain/comment-page-1/#comment-956</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Sat, 21 Oct 2006 04:22:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptedfun.com/pygame-starfield-rain/#comment-956</guid>
		<description>Thanks! :) I have read over the code a few times and i&#039;ve figured out how it works. I have one question. When you look at the rain droplets, you see that they are square shaped. Is there a way to make them circular?</description>
		<content:encoded><![CDATA[<p>Thanks! <img src='http://www.scriptedfun.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I have read over the code a few times and i&#8217;ve figured out how it works. I have one question. When you look at the rain droplets, you see that they are square shaped. Is there a way to make them circular?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck</title>
		<link>http://www.scriptedfun.com/pygame-starfield-rain/comment-page-1/#comment-955</link>
		<dc:creator>Chuck</dc:creator>
		<pubDate>Fri, 20 Oct 2006 13:45:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptedfun.com/pygame-starfield-rain/#comment-955</guid>
		<description>Carlo: Thank you so much for visiting the site, and I&#039;m glad you&#039;ve found the tutorials helpful. Sure, I&#039;d like to see what you&#039;re working on :). Thanks for the link to the article. I&#039;ve come across this article before, and I think it&#039;s really interesting. Hopefully, I&#039;ll be able to use the content of the article eventually to write something on game physics implementation. And yes, as you have pointed out, it should work well with a particle system. Thanks for pointing it out!

Dave: Sure! Feel free to use the code as you wish. :)</description>
		<content:encoded><![CDATA[<p>Carlo: Thank you so much for visiting the site, and I&#8217;m glad you&#8217;ve found the tutorials helpful. Sure, I&#8217;d like to see what you&#8217;re working on <img src='http://www.scriptedfun.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Thanks for the link to the article. I&#8217;ve come across this article before, and I think it&#8217;s really interesting. Hopefully, I&#8217;ll be able to use the content of the article eventually to write something on game physics implementation. And yes, as you have pointed out, it should work well with a particle system. Thanks for pointing it out!</p>
<p>Dave: Sure! Feel free to use the code as you wish. <img src='http://www.scriptedfun.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.scriptedfun.com/pygame-starfield-rain/comment-page-1/#comment-944</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Thu, 19 Oct 2006 19:59:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptedfun.com/pygame-starfield-rain/#comment-944</guid>
		<description>this is really interesting. Can I use the code in my own game?</description>
		<content:encoded><![CDATA[<p>this is really interesting. Can I use the code in my own game?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carlo</title>
		<link>http://www.scriptedfun.com/pygame-starfield-rain/comment-page-1/#comment-942</link>
		<dc:creator>Carlo</dc:creator>
		<pubDate>Wed, 18 Oct 2006 21:03:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptedfun.com/pygame-starfield-rain/#comment-942</guid>
		<description>Hey there, been following your blog for a while. I really like your tutorials, they&#039;re very helpful to me. I&#039;m working on a pygame of my own, I&#039;d like to get your opinion on it if you don&#039;t mind. 

As for a particle system, have you heard of Verlet integration? Here&#039;s the paper on it: http://www.teknikus.dk/tj/gdc2001.htm

It makes for really nice animations, and is nice because you only have to store the current location and old location of a particle.</description>
		<content:encoded><![CDATA[<p>Hey there, been following your blog for a while. I really like your tutorials, they&#8217;re very helpful to me. I&#8217;m working on a pygame of my own, I&#8217;d like to get your opinion on it if you don&#8217;t mind. </p>
<p>As for a particle system, have you heard of Verlet integration? Here&#8217;s the paper on it: <a href="http://www.teknikus.dk/tj/gdc2001.htm" rel="nofollow">http://www.teknikus.dk/tj/gdc2001.htm</a></p>
<p>It makes for really nice animations, and is nice because you only have to store the current location and old location of a particle.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
