Пример #1
0
	def added(self):
		# Bullets move faster that ships, so the pixels per second is higher.
		self.speed = 1000

		# This time, instead of using a static resource, we create a new rectangular graphic
		# at runtime.
		self.graphic = Image.create_rect(16, 4, 0x6B6B6B)
		self.width = 16
		self.height = 4
		self.type = 'bullet'
Пример #2
0
	def __init__(self):
		World.__init__(self)

		self.add_graphic(Image('EntityImage2.png'), 0, 50, 50)

		self.colortween = ColorTween(_type = Tween.LOOPING)
		self.add_tween(self.colortween)
		self.colortween.tween(5, 0xFF0000, 0x0000FF, ease=Ease.bounce_in_out)

		self.test = Image.create_rect(100, 100, 0x993333, 0.75)
		self.test.x = 200
		self.test.y = 200

		text = Text('Hello', 100, 100, size=48)

		gl = Graphiclist(self.test, text)
		self.add_graphic(gl, -1)
   
		self.game_entity = GameEntity()
		self.add(self.game_entity)

		self._button = Button(400, 200, self.on_button_click)
		self._button.set_spritemap('ButtonSheet.png', 50, 40)
		self.add(self._button)