Welcome Guest (Log in)


Game (40) | IOS (23) | Mobile (13) | Android (7) | High school (2) |
Expander triangle
  • Author
  • Rating
  • Type
  • Revision
  • Downloaded
  • Updated
  • Ben Beaumont
  • StarStarStarStarStar
  • Stack
  • 1
  • 5267 Times
  • 27 November 2012
Sheep Herder Game
This is the source code for the game SheepHerder which featured in the "build an app in 3 hours 15 minutes" video on YouTube.

This has been updated however to use graphics rather than images so that it can be scaled to run on any device.
Ajax Loader
Expander triangle
User Comments
Expander triangle
User thumbnail
Ben Beaumont
Nov 27, 2012
Here is the link to the original video:
User thumbnail
Ben Beaumont
Dec 4, 2012
SheepHerder is a very simple example of scaling but isn't suitable for all apps, particularly complex layouts. SheepHerder consists of 3 basic components:
- The pit - The sheep - The toolbar
Each component is a group which contains a resizeControl handler. Dragging to rescale any of these groups you'll notice it scales to the new size of group. You could call it object scaling. Each object in charge of laying itself out to the requested size. It keeps the code in the object itself and is my preferred way of coding.
In my stack script, on resizeStack, based on the orientation and size and the screen I set the size and position of each of the three components. The resizeControl is called causing each component to size itself to the new dimensions.
The result, a game that can be played on any screen size, density and orientation.
They key to the simplicity of the scaling of sheep herder is the use of graphic objects throughout. Scaling images is computationally expensive and quality is lost. This approach is not possible with every app of course, but if there is the option to use graphics, I would recommend it.