Exemple #1
0
 def configure(self, ev=None):
     self.resized = 0
     Game.configure(self, None)
     if self.resized:
         self.resized = 0
     if self._in_test:
         raise SkipTest
Exemple #2
0
 def configure(self):
     self.resized = 0
     Game.configure(self)
     if self.resized:
         self.resized = 0
         if self._in_test:
             raise SkipTest
Exemple #3
0
 def __init__(self):
     Game.__init__(self)
     self.set_background(color=(40, 40, 80))
     self.set_title('pybotwar')
     titleicon = String(message="pybotwar", fontSize=32)
     title = Stationary(sprite=titleicon)
     title.set_position((660, 10))
     title.draw()
Exemple #4
0
 def __init__(self):
     Game.__init__(self)
     self.set_background(color=(255, 255, 255))
     self.set_title('Tank AI')
     titleicon = String(message="Tank AI", fontSize=40, color=(50, 50, 50))
     title = Stationary(sprite=titleicon)
     title.set_position((660, 10))
     title.draw()
Exemple #5
0
 def __init__(self):
     MultiImage.__init__(self)
     if conf.game is None:
         game = Game()
         conf.game = game
         game.sprites.add(self)
         game.step()
     self.turn_off()
Exemple #6
0
 def __init__(self):
     Game.__init__(self)
     self.set_background(color=(40, 40, 80))
     self.set_title('pybotwar')
     titleicon = String(message="pybotwar", fontSize=32)
     title = Stationary(sprite=titleicon)
     title.set_position((660, 10))
     title.draw()
Exemple #7
0
    def initialize(self):
        Game.initialize(self)
        self.tom = DemoEPenguin()
        self.tom.set_demo(self)

        self.events.add(Event.QUIT_Event(callback=self._quit))
        self.events.add(Event.KEYUP_Event(key=K_ESCAPE, callback=self.configure))

        self.events.add(Event.KEYUP_Event(key=K_s, callback=self.skipfunc))
        self.events.add(Event.KEYUP_Event(key=K_h, callback=self.hide))
        self.events.add(Event.KEYUP_Event(key=K_q, callback=self._quit))
Exemple #8
0
 def initialize(self):
     Game.initialize(self)
     self.set_background(color=(50, 90, 130))
     self.target = Target()
     #self.target.draw()
     self.count = Score(pos=(20, 30), label='Targets:')
     self.count.addPoints(5)
     self.score = Score(pos=(20, 60), label='Moves:')
     self.score.addPoints(10)
     self.player = InteractPenguin()
     self.player.penUp()
     self.sprites.add(self.player)
     self.moveTarget()
Exemple #9
0
 def __init__(self):
     self._in_test = 0
     Game.__init__(self)
Exemple #10
0
    def move(self):
        Layer.move(self)
        x, y = self.get_position()
        #print x
        if 50 > x > 45:
            print 'change'
            self.set_background(color=RED)

class C2(Circle):
    def move(self):
        x, y = self.get_position()
        #print 'moving', x, y
        Circle.move(self)


game = Game()

layer = game.addLayer(size=(500, 500))
#print 1
layer.center()
#print 1
layer.set_background(color=BLUE)
layer.border(10)
#layer.path.set_velocity(vx=10, vy=10)

path = CirclePath()
path.set_loop(-1)
layer.set_path(path)
game.sprites.add(layer, level=1)

Exemple #11
0
 def checkEvents(self):
     Game.checkEvents(self)
     self.s.move_point()
Exemple #12
0
    def add_key(self, num):
        self.keys += num

    def do(self, cmd):
        if cmd=="left":
            self.turn("l")
        elif cmd=="right":
            self.turn("r")
        elif cmd=="fwd":
            self.forward()
        elif cmd=="wait":
            pass
        elif cmd=="push":
            self.forward()
        elif cmd=="pickup":
            pass
        elif cmd=="use":
            pass

    def set_coords(self,coords):
        self.coords=coords
        self.set_position(coord2pos(coords))

if __name__=="__main__":
    from pygsear.Game import Game
    g=Game()
    c=CatBot()
    g.sprites.add(c)
    g.mainloop()