-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Kivy Blueprints
By :
Next on our list is the playable character, that is, the biologically improbable Kivy Bird:

Rare species, the Kivy Bird sprite
There will be nothing fancy related to textures this time; in fact, the Bird class will be derived from Kivy's Image widget (kivy.uix.image.Image) to completely avoid doing any clever rendering whatsoever.
In kivybird.kv we need a bare minimum of properties involving the bird image depicted earlier; its initial position and size are given as follows:
Bird:
id: bird
pos_hint: {'center_x': 0.3333, 'center_y': 0.6}
size: (54, 54)
size_hint: (None, None)
source: 'bird.png'This is the initial implementation of the Bird class in Python:
from kivy.uix.image import Image as ImageWidget
class Bird(ImageWidget):
passYup, it does nothing at all. Soon, we're going to spoil it by adding rudimentary physics and other things, but first we need to lay some groundwork in the application class in order to make the game stateful.