Touch Develop is retiring on May 23, 2018. Learn More..


art

Resources such as pictures or sounds are referred to as art. They are considered to be constant and allow easy integration of pictures, sounds and other assets.

benefits of using art resources

There are several benefits to using art resources.
  • art is cached. This dramatically speeds up the script loading time and reduces the amount of data downloaded from the web.
  • art is automatically downloaded and bundled with exported apps. Thus, the exported app does not rely on the web anymore and can load those resources locally.
  • pictures and sounds are shared among all users: when uploading pictures and sounds, all other users of Touch Develop will be able to use your art in their scripts as well.
  • pictures are automatically optimized for sizes and screen size.

pictures

Pictures are a vital component of apps and games, so being able to easily add them to your script is quite important.

uploading pictures

Follow these steps to upload a picture to Touch Develop. The pictures you upload will be available for all Touch Develop users.
  • prepare your picture and save it as a .png or .jpeg file.
  • drag and drop the pictures into Touch Develop
or
  • from the hub, scroll to the right, tap on upload picture and follow the instructions.
  • from the script editor, tap the + under art, tap upload and follow the instructions.

usage

To use art pictures, add a new art variable and use tap on search online art picture to launch the search for picture. Once the variable is added, you can reference it under the art service which gets shortened to a flower symbol in the editor.
art pic : Picture
with data: "https://az31353.vo.msecnd.net/pub/ymggwtmn"
 pic → post to wall

tips for sprites

modifying art pictures

Because art is considered constant, it cannot be modified once it has been added to a script. Therefore you must first clone an art picture before making any modifications to it.
var cloned pic :=  pic → clone
cloned pic → tint(colors → sepia)
cloned pic → post to wall

sounds

Sound is another key ingredient to great gameplay.

Uploading sounds

  • prepare your sound as a MP3 file. You will find plenty of tools that can create this sound format.
  • from the hub, scroll to the right, tap on upload sound and follow the instructions.
  • from the script editor, tap the + under art, change the kind to Sound, tap upload and follow the instructions.

usage

To use art pictures, add a new art variable and use tap on search online art sound to launch the search for sound.
art snd : Sound
with data: "https://az31353.vo.msecnd.net/pub/fwvoauhk"

strings

There are 3 kind of Strings that can be stored as an art resource: a value, a url or a key.

values

A value stored in a string art resource will be returned as-is when reading the resource.
art value : String
with data:
Hello there!

urls

A 'url' stored in a string art resource will return the content of the url when reading the resource. The content of the url will be cached automatically.
art url : String
with data:
null

keys

A key stored in a string art resource must contain a URI that identifies the service consuming the key. Touch Develop will automatically map this URI to a key value that is stored privately on the cloud and will return this value. Use keys to create script accessing web services using API keys without leaking the API keys.
art key : String
with data:
null

colors and numbers

An art resource can also hold a number or a color.
art col : Color
with data: "#b85aad34"