Welcome Guest (Log in)

SheepHerder

StarStarStarStarStar
Game (28) | IOS (21) | Mobile (10) | Android (6) | High school (2) |
General
Expander triangle
  • Author
  • Rating
  • Type
  • Revision
  • Downloaded
  • Updated
  • Ben Beaumont
  • StarStarStarStarStar
  • Stack
  • 1
  • 4034 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
Tags
Expander triangle
User Comments
Expander triangle
User thumbnail
Ben Beaumont
StarStarStarStarStar
Nov 27, 2012
Here is the link to the original video:
http://www.youtube.com/watch?v=eabnlG6OtVI
User thumbnail
Ben Beaumont
StarStarStarStarStar
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.