pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
NanoBomber

NanoBomber - 694B

Hewitt Squared Labs (hewitt2labs)

Tags:

Description

A game inspired by a couple of snake games being made as byte compact as possible. Press space to drop a bomb, the squares to the right are worth more points. (the ones that turn black anyways)

Code

Warning! code is currently broken! see below for details
from pygame import *
D=display;L=D.set_mode((640,224)).fill;P=B=F=C=E=0;M=32;H=D.set_caption;
def I():
 for e in event.get():
  if e.type==12:z
  if e.type==2:
   if e.key==27:z
   if e.key==32:return 1
while 1:
 time.Clock().tick(10)
 if E>0:
  P-=32
  if P<0:P=639
  if F:B+=32
  else:F=I()
  if B>223:F=0;B=0
  if B>64:C+=T[B/M][P/M][0];T[B/M][P/M][0]=0
  E-=0.1;H("Score:%s Time:%s"%(C,E))
 else:
  H("Game Over Score:%s (space to start)"%(C));F=I()
  if F:E=60;P=F=B=C=0;T=[[[x+1,x,y]for x in range(20)]for y in range(7)]
  L(0)
  for t in T:
   for s in t:
    g,x,y=s
    if g:
     j=255-x*12;L((j,255,j),((x*M,y*M),(M,M)))
  L(255,((P+8,B+8),(2,2)));L(16711680,((P,0),(M*2,M)));D.flip()
Seriously considering a easier to read dev version!

Notes

  • Byte count is using LF (linefeed) endings NOT CRLF(cairrage-return/linefeed) since gedit won't use CRLF.
  • There is probably many things that could be done to make it shorter(much shorter) but it's working! (sort of :))

Agenda

(Numbered in order of pseudo-importance)
  1. Make "plane" fly all the time and only activate "bombs" when timer is going down.(It might make the code smaller)
  2. Make the top two rows of "blocks" black. They're not because
    T[:2][:]=[0,0,0]
    won't make the first 40 sub-sub lists of T = [0,0,0]! (thinking about it, it should actually be:
    T[:2][:][0]=0
    to change the color...)
  3. Move "plane" in pixel increments instead of 32p blocks
  4. Make "bomb" bigger. (Hard to see right now)

Links

Home Page: http://www.pygame.org/project-NanoBomber-1468-2618.html

Screenshot


click to view original size

Releases

NanoBomber - 694B - Apr 18, 2010

Pygame.org account Comments

If you wish to leave a comment with your pygame.org account, please sign in first.

September 3, 2010 11:44pm - Hewitt Squared Labs - nickname: (hewitt2labs)
Resuming development, I have been busy for the past few months, but I'm back to fix this.
April 20, 2010 9:14am - Hewitt Squared Labs - nickname: (hewitt2labs)
Upon testing it has been found that the code is currently not working. Please excuse the premature hype (but it worked before it was uploaded! though it was changed...oops)
April 20, 2010 9:10am - Hewitt Squared Labs - nickname: (hewitt2labs)
So HTML doesn't work in the comments! Excuse the mess
April 20, 2010 9:09am - Hewitt Squared Labs - nickname: (hewitt2labs)
That's a code mistake, there should be a line that defines it before the <pre>while 1</pre> That'll be added ASAP. It's the same as on line 21, the last command on that line <pre>T=[[[x+1,x,y]for x in range(20)]for y in range(7)]
</pre> If you want to play it immediately, Just insert that in front of the <pre>while 1</pre>
April 20, 2010 12:20am - Xandar Kablandar - nickname: (eternalcheesecake)
I'm curious to play it but I'm getting this error:

Traceback (most recent call last):
File "./NanoBomber.py", line 24, in <module>
for t in T:
NameError: name 'T' is not defined
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Nov 13, 2014

Nov 11, 2014


Nov 10, 2014

Nov 9, 2014

Nov 6, 2014


Nov 4, 2014

Nov 3, 2014

Oct 28, 2014

Oct 21, 2014

Oct 16, 2014

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)