usr bin env python import pygame sys os from pygame locals import impo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#! /usr/bin/env python
import pygame, sys, os
from pygame.locals import *
import binascii
from cStringIO import StringIO
tank="""
----------------
-------++-------
-------++-------
-------++-------
------++++------
-------++-------
------+--+------
------+--+------
------+--+------
--+---+--+---+--
+++++++--+++++++
++++++++++++++++
++++++++++++++++
++----+--+----++
++------------++
++++++++++++++++
"""
alien="""
-----++--++-----
-----++--++-----
------+--+------
-----++--++-----
----++++++++----
--++++++++++++--
++++---++---++++
-+++--++++--+++-
-++++++++++++++-
--++++++++++++--
-++++-+--+-++++-
--+-++++++++-+--
-+-+--------+-+-
-++----------++-
-+------------+-
----------------
"""
def image(color, shape="block", pixelstring=None):
img = pygame.Surface((16, 16))
if shape == "block":
img.fill(Color(color))
if shape == "circle":
pygame.draw.ellipse(img, Color(color), (1, 1, 14, 14))
img.set_colorkey((0, 0, 0), RLEACCEL)
if pixelstring:
img.set_colorkey((0, 0, 0), RLEACCEL)
x=0
y=-1
for line in pixelstring.split("\n"):
for char in line:
if char == "+":
img.fill(Color(color), (x, y, 1, 1))
x += 1
y += 1
x = 0
return img
def main():
pygame.init()
pygame.display.set_caption("xNz 1st game")
pygame.mouse.set_visible(0)
screen = pygame.display.set_mode((800, 600), 0, 32)
screen.fill((0, 0, 0))
pygame.display.flip()
if __name__ == "__main__":
main()