Reader small image

You're reading from  Kivy - Interactive Applications and Games in Python

Product typeBook
Published inJun 2015
Reading LevelBeginner
Publisher
ISBN-139781785286926
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Roberto Ulloa
Roberto Ulloa
author image
Roberto Ulloa

Roberto Ulloa has a diverse academic record in multiple disciplines within the field of computer science. Currently, he is working with artificial societies as part of his PhD thesis at the University of Western Ontario. He obtained an MSc degree from the University of Costa Rica and taught programming and computer networking there. He has earned a living as a web developer, working with Python/Django and PHP/Wordpress. He collaborates with various researchers while also working on his own projects, including his blog (http://robertour.com). He constantly worries that the Internet has already become aware of itself and that we are not able to communicate with it because of the improbability of it being able to speak any of the 6,000-plus odd human languages that exist on the planet.
Read more about Roberto Ulloa

Right arrow

Fleet – infinite concatenation of animations


In this section, we will animate the fleet so that it has perpetual movement from right to left and vice versa, as shown by the arrows in the following screenshot:

In order to do this, we will learn how to concatenate one animation just after another one is completed. Indeed, we will create an infinite loop of animations so that the fleet is in perpetual movement.

Tip

We can concatenate two animations with the on_complete event.

The following code, fragment 1 (of 2), of fleet.py shows how to concatenate these events:

155. # File name: fleet.py (Fragment 1)
156. from kivy.uix.gridlayout import GridLayout
157. from kivy.properties import ListProperty
158. from kivy.animation import Animation
159. from kivy.clock import Clock
160. from kivy.core.window import Window
161. from random import randint, random
162. from dock import Dock
163. 
164. class Fleet(GridLayout):
165.   survivors = ListProperty(())
166. 
167.   def __init__(self,  **kwargs):
168....
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Kivy - Interactive Applications and Games in Python
Published in: Jun 2015Publisher: ISBN-13: 9781785286926

Author (1)

author image
Roberto Ulloa

Roberto Ulloa has a diverse academic record in multiple disciplines within the field of computer science. Currently, he is working with artificial societies as part of his PhD thesis at the University of Western Ontario. He obtained an MSc degree from the University of Costa Rica and taught programming and computer networking there. He has earned a living as a web developer, working with Python/Django and PHP/Wordpress. He collaborates with various researchers while also working on his own projects, including his blog (http://robertour.com). He constantly worries that the Internet has already become aware of itself and that we are not able to communicate with it because of the improbability of it being able to speak any of the 6,000-plus odd human languages that exist on the planet.
Read more about Roberto Ulloa