Table of Contents

play()

Function Definition: play(sound_name = "Grunt")

Parameters

NameTypeDescriptionExpected ValuesDefault Value
sound_namestringThe name of the sound.String"Grunt"

Description

The function will play the specified sound, with no pause to its script.

Example

Learn how to create a dance sequence with Quadruped and Music using PictoBlox in this tutorial.

Introduction

The example demonstrates how to create a dance sequence with Quadruped with Music.

Code for Stage Mode

  1. When Quarky‘s left pushbutton is pressed, it will wait for 1 second and play a sound. 
  2. After that, Quadruped will wave its right hand and move back to the “home position. Then 
  3. Quarky will play different tones and Quadruped will do different actions. 
  4. Finally, Quadruped will move back to the “home position.
sprite = Sprite('Tobi')
quarky = Quarky()
import time

quad=Quadruped(4,1,8,5,3,2,7,6)


quad.home()
while True
	quarky.playsound("QuarkyIntro")
	quad.action("right hand wave",700,2)
	quad.home()
	quarky.playtone("E5",8)
	quad.action("front back",700,3)
	quarky.playtone("C4",8)
	quad.action("bodyshake2",700,3)
	quarky.playtone("D4",8)
	quad.action("bodyshake3",700,3)
	quarky.playtone("E4",8)
	quad.action("bodyshake4",700,3)
	quarky.playtone("C5",8)
	quad.action("updown1",700,3)
	quad.home()

Code for Upload Mode

You can also make the Quadruped dance work independent of PictoBlox using the Upload Mode. For that switch to upload mode. 

Output

Explore: Try to create your dance sequence.
Read More
All articles loaded
No more articles to load