Sprite Sheet Study with scrolling - simplified

Skip to first unread message

Scott Ferguson

Mar 5, 2016, 8:00:01 AM3/5/16
to app-inventor-de...@googlegroups.com
Changes log: version 2 bug fix on non-looping animations and eliminated some redundancy in the blocks. 20160305:07:51

This is a tweak of the Sprite Sheet Study with Scrolling which used one list and starting and ending indices to that list to pick ranges of images for animating a hero character.

This simplified variation, instead uses the same sprite sheet images, but places their names in separate lists for each type of animation.

That eliminates the need for a starting and ending index into the list.

The new animation snippet is called PickNextFrame and takes three arguments: Picture, Frames, Looping

Frames is a list of names for pictures stored in the Media folder.
Picture may be empty text, one of the picture names in the Frames list, or any other text.
Looping is a logic value true or false -- true if the animation should loop, false if it should run once.

Note that PickNextFrame requires that the picture names in the lists are all unique as the index is derived from the index in list block, which will find only the first matching Picture in a list and ignore all others.
If your lists will contain duplicates, then use a global counter variable for the index instead.

Background provided by user ansimuz at http://opengameart.org/content/country-side-platform-tiles

Reply all
Reply to author
0 new messages