In the last code provided I messed up the Bullet Class Code. Apologies for that. Below is my code :<div><br></div><div><div>import pygame</div><div>from pygame.locals import *</div><div>import random</div><div>import time</div>

<div><br></div><div>pygame.init()</div><div>screen=pygame.display.set_mode((640,480),0,24)</div><div>pygame.display.set_caption(&quot;Hit The Stone&quot;)</div><div>background=pygame.Surface(screen.get_size())</div><div>
background=background.convert()</div>
<div>screen.blit(background,(0,0))</div><div><br></div><div>class Plane(pygame.sprite.Sprite):</div><div>    def __init__(self):</div><div>        pygame.sprite.Sprite.__init__(self)</div><div>        self.image=pygame.image.load(&#39;plane.gif&#39;).convert()</div>

<div>        self.rect=self.image.get_rect()</div><div>        self.rect.centerx=random.randint(0,screen.get_width())</div><div>        self.distancefromcenter=30</div><div>        self.rect.centery=screen.get_height()-self.distancefromcenter</div>

<div>        self.dx=2</div><div>        self.dy=2</div><div><br></div><div>    def update(self):</div><div>        self.pressed=pygame.key.get_pressed()</div><div>        if self.pressed[K_DOWN]:</div><div>            self.rect.centery+=self.dy</div>

<div>        elif self.pressed[K_UP]:</div><div>            self.rect.centery-=self.dy</div><div>        elif self.pressed[K_LEFT]:</div><div>            self.rect.centerx-=self.dx</div><div>        elif self.pressed[K_RIGHT]:</div>

<div>            self.rect.centerx+=self.dx</div><div>            </div><div><br></div><div>        if self.rect.bottom&gt;=screen.get_height():</div><div>            self.rect.bottom=screen.get_height()</div><div>        elif self.rect.top&lt;=0:</div>

<div>            self.rect.top=0</div><div><br></div><div>        if self.rect.centerx&gt;=screen.get_width()-self.distancefromcenter:</div><div>            self.rect.centerx=screen.get_width()-self.distancefromcenter</div>

<div>        elif self.rect.centerx&lt;=self.distancefromcenter:</div><div>            self.rect.centerx=self.distancefromcenter</div><div><br></div><div>             </div><div><br></div><div><br></div><div>class Bullet(pygame.sprite.Sprite):</div>

<div>    def __init__(self,posx,posy,image):</div><div>        pygame.sprite.Sprite.__init__(self)</div><div>        self.image=image</div><div>        self.rect=self.image.get_rect()</div><div>        self.rect.center=(posx,posy-30)</div>

<div>        self.dy=5</div><div>        </div><div><br></div><div><br></div><div>    def update(self):</div><div>        self.rect.centery-=self.dy</div><div>        self.rect.center=(self.rect.centerx,self.rect.centery)</div>

<div>        if self.rect.top&lt;=0:</div><div>            self.kill()</div><div>class Blank(pygame.sprite.Sprite):</div><div>    def __init__(self,posx,posy):</div><div>        pygame.sprite.Sprite.__init__(self)</div><div>

        self.image=pygame.Surface((10,20))</div><div>        self.image.fill((0,0,0))</div><div>        self.rect=self.image.get_rect()</div><div>        self.rect.center=(posx,posy-30)</div><div>        self.dy=5</div><div>

        </div><div><br></div><div>    def update(self):</div><div>        self.rect.centery-=self.dy</div><div>        self.rect.center=(self.rect.centerx,self.rect.centery)</div><div>        if self.rect.top&lt;=0:</div>

<div>            self.kill()</div><div>        </div><div><br></div><div>def main():</div><div>    image=pygame.image.load(&#39;geometrybullet.png&#39;).convert()</div><div>    plane=Plane()</div><div>    allSprites=pygame.sprite.Group(plane)</div>

<div>    clock=pygame.time.Clock()</div><div><br></div><div>    while 1:</div><div>        pressed=pygame.key.get_pressed()</div><div>        for i in pygame.event.get():</div><div>            if i.type==QUIT or pressed[K_q]:</div>

<div>                exit()</div><div>        if  pressed[K_SPACE]:</div><div>                bullet=Bullet(plane.rect.centerx,plane.rect.centery,image)</div><div>                bullet.shootCount=0</div><div>                allSprites.add(bullet)</div>

<div>                </div><div><br></div><div>        allSprites.clear(screen,background)</div><div>        allSprites.update()</div><div>        allSprites.draw(screen)</div><div>        pygame.display.flip()</div><div>

<br></div><div><br></div><div>if __name__==&#39;__main__&#39;:</div><div>    main()</div><div>        </div><div>        </div><br><div class="gmail_quote">On Thu, Jan 12, 2012 at 11:01 PM, ANKUR AGGARWAL <span dir="ltr">&lt;<a href="mailto:coolankur2006@gmail.com">coolankur2006@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>import pygame</div><div>from pygame.locals import *</div><div>import random</div><div><br></div><div>pygame.init()</div>

<div>screen=pygame.display.set_mode((640,480),0,24)</div><div>pygame.display.set_caption(&quot;Hit The Stone&quot;)</div>
<div>background=pygame.Surface(screen.get_size())</div><div>background=background.convert()</div><div>screen.blit(background,(0,0))</div><div><br></div><div>class Plane(pygame.sprite.Sprite):</div><div>    def __init__(self):</div>


<div>        pygame.sprite.Sprite.__init__(self)</div><div>        self.image=pygame.image.load(&#39;plane.gif&#39;).convert()</div><div>        self.rect=self.image.get_rect()</div><div>        self.rect.centerx=random.randint(0,screen.get_width())</div>


<div>        self.distancefromcenter=30</div><div>        self.rect.centery=screen.get_height()-self.distancefromcenter</div><div>        self.dx=2</div><div>        self.dy=2</div><div><br></div><div>    def update(self):</div>


<div>        self.pressed=pygame.key.get_pressed()</div><div>        if self.pressed[K_DOWN]:</div><div>            self.rect.centery+=self.dy</div><div>        elif self.pressed[K_UP]:</div><div>            self.rect.centery-=self.dy</div>


<div>        elif self.pressed[K_LEFT]:</div><div>            self.rect.centerx-=self.dx</div><div>        elif self.pressed[K_RIGHT]:</div><div>            self.rect.centerx+=self.dx</div><div>            </div><div><br>


</div><div>        if self.rect.bottom&gt;=screen.get_height():</div><div>            self.rect.bottom=screen.get_height()</div><div>        elif self.rect.top&lt;=0:</div><div>            self.rect.top=0</div><div><br></div>


<div>        if self.rect.centerx&gt;=screen.get_width()-self.distancefromcenter:</div><div>            self.rect.centerx=screen.get_width()-self.distancefromcenter</div><div>        elif self.rect.centerx&lt;=self.distancefromcenter:</div>


<div>            self.rect.centerx=self.distancefromcenter</div><div><br></div><div>             </div><div><br></div><div><br></div><div>class Bullet(pygame.sprite.Sprite):</div><div>    def __init__(self,posx,posy,image):</div>


<div>        pygame.sprite.Sprite.__init__(self)</div><div>        if self.shootCount&gt;10:                 </div><div>            self.image=image</div><div>            self.rect=self.image.get_rect()</div><div>            self.rect.center=(posx,posy-30)</div>


<div>            self.dy=5</div><div>        else:</div><div>            self.shootCount+=1</div><div><br></div><div><br></div><div>    def update(self):</div><div>        self.rect.centery-=self.dy</div><div>        self.rect.center=(self.rect.centerx,self.rect.centery)</div>


<div>        if self.rect.top&lt;=0:</div><div>            self.kill()</div><div><br></div><div><br></div><div>def main():</div><div>    image=pygame.image.load(&#39;geometrybullet.png&#39;).convert()</div><div>    plane=Plane()</div>


<div>    allSprites=pygame.sprite.Group(plane)</div><div>    clock=pygame.time.Clock()</div><div><br></div><div>    while 1:</div><div>        pressed=pygame.key.get_pressed()</div><div>        for i in pygame.event.get():</div>


<div>            if i.type==QUIT or pressed[K_q]:</div><div>                exit()</div><div><b>        if  pressed[K_SPACE]:</b></div><div><b>                bullet=Bullet(plane.rect.centerx,plane.rect.centery,image)</b></div>


<div><b>                bullet.shootCount=0</b></div><div><b>                allSprites.add(bullet)</b></div><div>                </div><div><br></div><div>        allSprites.clear(screen,background)</div><div>        allSprites.update()</div>


<div>        allSprites.draw(screen)</div><div>        pygame.display.flip()</div><div><br></div><div><br></div><div>if __name__==&#39;__main__&#39;:</div><div>    main()</div><div>        </div><div><br></div><div>I was trying to make shooting game. whenever I press the space key bullet object is called (bold code) . I want delay between iterations to produce the gap between the bullets.Tried the time.wait() but its working. Any Ideas??</div>


<div><br></div><div>Thanks In Advance</div><div><br></div><div>Regards</div><span class="HOEnZb"><font color="#888888"><div>Ankur Aggarwal</div><div>        </div>
</font></span></blockquote></div><br></div>