pygsear-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygsear] A layer as a viewport


From: Lee Harr
Subject: Re: [pygsear] A layer as a viewport
Date: Sun, 08 Jun 2003 01:24:04 +0000

I've been trying to figure out how to use a Drawable.Layer as a viewport so the game doesn't take up the entire window and I can have a smaller game area. While I can create a Layer and make the sprites use it instead of the entire window, I can't seem to make the Layer change backgrounds, or move to anywhere but the top left corner, or draw a border around it !
Anyone know why this is ?



I can color the layer, and make it move with this:

# layertest.py
from pygsear.Drawable import Layer, Circle
from pygsear.Game import Game
from pygsear.locals import BLUE, RED

class L2(Layer):
   def move(self):
       Layer.move(self)
       x, y = self.getPosition()
       #print x
       if 50 > x > 45:
           #print 'change'
           self.setBackground(color=RED)

layer = L2()
layer.center()
layer.setBackground(color=BLUE)
layer.path.set_velocity(vx=10, vy=10)

circle = Circle(layer)
circle.center(y=20)
circle.path.set_velocity(vx=5)

game = Game()
game.sprites.add(layer)
game.sprites.add(circle)
game.mainloop()
#


but it looks like Paths do not really understand layers...

I am looking at it now, but layers are still kind of experimental. Looks like
it would be good to have some way to say which objects are in front of
or behind others too....

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail





reply via email to

[Prev in Thread] Current Thread [Next in Thread]