Skip to content
Browse files

Started adding original beer tapper graphics to the game. Also cleane…

…d up Android ant build a little to support fullscreen mode, landscape mode and the game's icon. Finally added PSDs to help with generating game artwork.
  • Loading branch information...
1 parent 54baab0 commit d0c3e223616dba91b1a64074cee96b2b94304fb0 @jessefreeman jessefreeman committed Jul 4, 2010
Showing with 520 additions and 44 deletions.
  1. +28 −0 DeveloperHappyHour.iml
  2. +2 −2 build.template.properties
  3. +1 −1 build.xml
  4. +8 −5 build/android-resources/template-air-app.xml
  5. BIN build/assets/bar_background.png
  6. BIN build/assets/bartender_placeholder.png
  7. BIN build/assets/beer_mug.png
  8. BIN build/assets/beer_mug_full.png
  9. BIN build/assets/hello_world.png
  10. BIN build/assets/opening_screen.png
  11. BIN build/assets/opening_screen_animation.png
  12. BIN build/assets/opening_screen_animation/_0000_Frame-10.png
  13. BIN build/assets/opening_screen_animation/_0001_Frame-9.png
  14. BIN build/assets/opening_screen_animation/_0002_Frame-8.png
  15. BIN build/assets/opening_screen_animation/_0003_Frame-7.png
  16. BIN build/assets/opening_screen_animation/_0004_Frame-6.png
  17. BIN build/assets/opening_screen_animation/_0005_Frame-5.png
  18. BIN build/assets/opening_screen_animation/_0006_Frame-4.png
  19. BIN build/assets/opening_screen_animation/_0007_Frame-3.png
  20. BIN build/assets/opening_screen_animation/_0008_Frame-2.png
  21. BIN build/assets/opening_screen_animation/_0009_Frame-1.png
  22. BIN build/assets/opening_screen_animation/_0010_Frame-0.png
  23. BIN build/assets/patron_placeholder.png
  24. BIN build/bin-resources/images/icons/app-logo-36x36.png
  25. BIN build/bin-resources/images/icons/app-logo-48x48.png
  26. BIN build/bin-resources/images/icons/app-logo-72x72.png
  27. BIN build/psds/app-logo.psd
  28. BIN build/psds/bar_background.psd
  29. BIN build/psds/bartender-placeholder.psd
  30. BIN build/psds/beer_mug_full.psd
  31. BIN build/psds/opening_screen.psd
  32. +1 −0 build/psds/opening_screen_animation-positions.xml
  33. BIN build/psds/opening_screen_animation.psd
  34. BIN build/psds/patron_placeholder.psd
  35. +383 −0 build/scripts/PSSpriteSheet.jsx
  36. +32 −6 src/BeerMug.as
  37. +3 −3 src/DeveloperHappyHour.as
  38. +10 −2 src/Patron.as
  39. +25 −16 src/PlayState.as
  40. +9 −2 src/Player.as
  41. +18 −7 src/StartGameState.as
View
28 DeveloperHappyHour.iml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="Flex" version="4">
+ <component name="Flex.Build.Configuration">
+ <option name="DO_BUILD" value="true" />
+ <option name="OUTPUT_FILE_NAME" value="DeveloperHappyHour.swf" />
+ <option name="TARGET_PLAYER_VERSION" value="10.0.0" />
+ <option name="VERSION" value="3" />
+ </component>
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ </content>
+ <orderEntry type="jdk" jdkName="4.0.0 (player 10)" jdkType="Flex SDK Type" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="file://$MODULE_DIR$/build/libs" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ <jarDirectory url="file://$MODULE_DIR$/build/libs" recursive="false" />
+ </library>
+ </orderEntry>
+ </component>
+</module>
+
View
4 build.template.properties
@@ -16,10 +16,10 @@ APPARAT_HOME = path/to/apparat/
SCALA_HOME = path/to/sdk
#Properties file for build.xml
-project.name = FlashTDDProject
+project.name = DeveloperHappyHour
#Version number
-ver.num=v0.0.0
+ver.num=v0.3.0-alpha
project.name.versioned=${project.name}-${ver.num}
deploy.name.versioned=${project.name}-${ver.num}
View
2 build.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<project name="FlashTDDProject" basedir="." default="full-build">
+<project name="DeveloperHappyHour" basedir="." default="full-build">
<!-- identify properties file -->
<property file="build.properties" />
View
13 build/android-resources/template-air-app.xml
@@ -8,10 +8,13 @@
<initialWindow>
<content>swfs/@projectversion@.swf</content>
<visible>true</visible>
+ <fullScreen>true</fullScreen>
+ <aspectRatio>landscape</aspectRatio>
+ <autoOrients>false</autoOrients>
</initialWindow>
- <!--<icon>
-<image72x72>images/logos/app-logo-72x72.png</image72x72>
-<image48x48>images/logos/app-logo-48x48.png</image48x48>
-<image36x36>images/logos/app-logo-36x36.png</image36x36>
-</icon>-->
+ <icon>
+ <image72x72>images/icons/app-logo-72x72.png</image72x72>
+ <image48x48>images/icons/app-logo-48x48.png</image48x48>
+ <image36x36>images/icons/app-logo-36x36.png</image36x36>
+ </icon>
</application>
View
BIN build/assets/bar_background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/bartender_placeholder.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/beer_mug.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/beer_mug_full.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/hello_world.png
Deleted file not rendered
View
BIN build/assets/opening_screen.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/opening_screen_animation.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/opening_screen_animation/_0000_Frame-10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/opening_screen_animation/_0001_Frame-9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/opening_screen_animation/_0002_Frame-8.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/opening_screen_animation/_0003_Frame-7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/opening_screen_animation/_0004_Frame-6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/opening_screen_animation/_0005_Frame-5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/opening_screen_animation/_0006_Frame-4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/opening_screen_animation/_0007_Frame-3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/opening_screen_animation/_0008_Frame-2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/opening_screen_animation/_0009_Frame-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/opening_screen_animation/_0010_Frame-0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/assets/patron_placeholder.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/bin-resources/images/icons/app-logo-36x36.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/bin-resources/images/icons/app-logo-48x48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/bin-resources/images/icons/app-logo-72x72.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/psds/app-logo.psd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/psds/bar_background.psd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/psds/bartender-placeholder.psd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/psds/beer_mug_full.psd
Diff not rendered.
View
BIN build/psds/opening_screen.psd
Diff not rendered.
View
1 build/psds/opening_screen_animation-positions.xml
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" ?>
View
BIN build/psds/opening_screen_animation.psd
Diff not rendered.
View
BIN build/psds/patron_placeholder.psd
Diff not rendered.
View
383 build/scripts/PSSpriteSheet.jsx
@@ -0,0 +1,383 @@
+/*
+ * Written by Aidan Coyne, in 2010, at Roundarch, under the direction of Jesse Freeman.
+ * See README for info, and LICENSE for MIT License.
+ */
+
+function prop(name, value) { return name + "=\"" + value + "\""; }
+
+//generate a sprite node.
+function spriteString(x, y, w, h, name)
+{
+ return "<sprite" + " " + prop("name", name)
+ + " " + prop("x", x)
+ + " " + prop("y", y)
+ + " " + prop("w", w)
+ + " " + prop("h", h)
+ + " />";
+
+}
+
+function sheetString(sheet)
+{
+ return "<sheet" + " " + prop("name", sheet.name)
+ + " " + prop("src", sheet.longName + sheet.suffix)
+ + " " + prop("w", sheet.doc.width.value)
+ + " " + prop("h", sheet.doc.height.value)
+ + ">";
+
+}
+
+function closeSheet() { return "</sheet>";}
+
+//This represents a sheet object - it has some locations and naming stuff, export options, and source layers
+//cycle: createDoc, layout, saveAndExport
+function Sheet(sourceLS)
+{
+ this.posFile = Sheet.posFile;
+ this.baseLoc = Sheet.baseLocation;
+ this.baseName = Sheet.baseName;
+ this.opts = Sheet.opts;
+ this.useVariableSpaces = Sheet.useVariableSpaces;
+ this.genXML = Sheet.genXML;
+ this.saveByExport = Sheet.saveByExport;
+
+ this.doc = null;
+ this.sourceLS = sourceLS;
+ this.name = sourceLS.name;
+ this.longName = this.baseName + "-" + this.name;
+
+ this.suffix = ".psd";
+ if (this.saveByExport)
+ {
+ this.suffix = ".png";
+ if (this.opts.format == SaveDocumentType.JPEG)
+ this.suffix = ".jpg";
+ else if (this.opts.format == SaveDocumentType.COMPUSERVEGIF)
+ this.suffix = ".gif";
+ }
+
+
+ // saves doc as PSD in file, and exports images of aprropriate type
+ this.saveOrExport = function()
+ {
+ var destFile = new File(this.baseLoc+ "/" + this.longName + this.suffix);
+ if (this.saveByExport)
+ {
+ this.doc.exportDocument(destFile, ExportType.SAVEFORWEB, this.opts);
+ }
+ else
+ {
+ var saveOpt = new PhotoshopSaveOptions();
+ this.doc.saveAs(destFile, saveOpt, false, Extension.LOWERCASE);
+ }
+ }
+
+ //This function generates a new document,
+ //copies each layer from the source layer set into the new document,
+ //and figures out the width of the new document
+ this.createDoc = function(sourceDoc)
+ {
+ var sourceLS = this.sourceLS;
+ //create a new document that the layers can be copied to.
+ var width = sourceLS.bounds[2] - sourceLS.bounds[0];
+ var height = sourceLS.bounds[3] - sourceLS.bounds[1];
+
+ this.doc = documents.add(width, height, sourceDoc.resolution, this.longName,
+ NewDocumentMode.RGB, DocumentFill.TRANSPARENT);
+
+ var newWidth = 0;
+ //for every visible layer in the layer set, copy the layer over to the new document,
+ //and (if in variable space mode) sum up the widths.
+ for (var i=0; i < sourceLS.artLayers.length; i++)
+ {
+ var layer = sourceLS.artLayers[i];
+ if (layer.visible)
+ {
+ //the requirement that the active doc be switched is irritating, I know.
+ activeDocument = sourceDoc;
+ layer.copy();
+ activeDocument = this.doc;
+ //we want to keep the original layer names. Yes, this does exactly that.
+ this.doc.paste().name = layer.name;
+ if (this.useVariableSpaces)
+ newWidth += (layer.bounds[2] - layer.bounds[0]);
+ }
+ }
+ if (!this.useVariableSpaces)
+ newWidth = sourceLS.artLayers.length * width;
+ this.doc.resizeCanvas(newWidth, this.doc.height, AnchorPosition.TOPLEFT);
+ }
+
+ //lays out the layers of the spritesheet, logs information
+ this.layout = function(indent)
+ {
+ var xpos = new UnitValue(0, "px"); //have to make this a unit value for initial subtraction to work.
+ var sourceLS = this.sourceLS;
+
+ //used for non-variable spacing mode:
+ this.defWidth = sourceLS.bounds[2] - sourceLS.bounds[0];
+ this.defHeight = sourceLS.bounds[3] - sourceLS.bounds[1];
+
+ if (this.genXML)
+ this.posFile.writeln(indent + sheetString(this));
+ var indent2 = indent+indent;
+ //this loop moves each layer
+ for (var i=0; i < this.doc.artLayers.length; i++)
+ {
+ xpos = this.moveLayer(this.doc.artLayers[i], xpos, indent2);
+ }
+ if (this.genXML)
+ this.posFile.writeln(indent + closeSheet());
+ }
+
+ //places the next layer in the new PSD, writes the position and dimensions to the file
+ this.moveLayer = function(layer, newX, indent)
+ {
+ //place object all the way to the top left of the available space
+ //remember that translate is relative to the current position of the layer.
+ var negativeY = new UnitValue(-layer.bounds[1], "px");
+ layer.translate(newX - layer.bounds[0], negativeY);
+
+ //obtain the current dimensions and position of the layer.
+ var x = layer.bounds[0];
+ var width = layer.bounds[2] - x;
+ var y = layer.bounds[1];
+ var height = layer.bounds[3] - y;
+
+ //If spacing is variable, then sprite is located properly.
+ //Otherwise, center the sprite, and use the default sizes.
+ if (!this.useVariableSpaces)
+ {
+ var xoffset = (this.defWidth - width) * 0.5;
+ var yoffset = (this.defHeight - height) * 0.5;
+ layer.translate(xoffset, yoffset);
+ width = this.defWidth;
+ height = this.defHeight;
+ }
+
+ if (this.genXML)
+ this.posFile.writeln(indent +
+ spriteString(x.value, y.value, width.value, height.value, layer.name));
+
+ //update the x position.
+ return newX + width;
+ }
+
+ //close the document.
+ this.close = function()
+ {
+ this.doc.close(SaveOptions.DONOTSAVECHANGES);
+ }
+}
+
+//Brings up a dialog asking about how export should be done.
+function getFormatOpts(sourceDoc)
+{
+ //The dialog is built using a resource string.
+ var dia = new Window(
+ "dialog \
+ { \
+ orientation: 'column', alignChildren: 'fill',\
+ info: Panel \
+ { orientation: 'column', alignChildren: 'fill', \
+ text: 'Format Options', \
+ format : Group \
+ { \
+ orientation: 'row', alignChildren:'fill', \
+ prompter : StaticText { text: 'What format to export in?'}, \
+ chooser : DropDownList { alignment: 'left' } \
+ },\
+ pngOpts: Group \
+ { \
+ orientation: 'row', \
+ typeCheck: Checkbox { text: 'Use PNG24 instead of PNG8.' }\
+ },\
+ jpgOpts: Group \
+ { \
+ orientation: 'column', alignChildren: 'left',\
+ msg: StaticText { text: 'How good should the quality be?' },\
+ quality: Group \
+ { \
+ orientation: 'row', alignChildren: 'left', \
+ slide: Slider { minValue: '0', maxValue: '100', value: '60'}\
+ current: EditText { text: '60', characters: '3'}\
+ },\
+ },\
+ gifOpts: Group \
+ { \
+ orientation: 'row' \
+ },\
+ psdOpts: Group \
+ {\
+ orientation: 'row'\
+ }\
+ }, \
+ genOpts: Panel \
+ { \
+ orientation: 'column', alignChildren: 'fill',\
+ text: 'Generation options', \
+ xmlCheck: Checkbox { text : 'Generate XML positions file', value: 'true' }, \
+ variablePlacing: RadioButton { text: 'Place sprites using varying spacing', value: 'true'},\
+ constantPlacing: RadioButton { text: 'Place sprites with constant sized areas'}\
+ },\
+ locPick: Panel \
+ { \
+ orientation: 'row', alignChildren: 'center', \
+ text: 'Location',\
+ currentLoc: StaticText {characters: '40', properties:{truncate:'middle'}},\
+ bringDialog: Button {text: 'Browse'}\
+ },\
+ buttonsCont: Group \
+ { \
+ orientation: 'column', alignChildren: 'center',\
+ buttons: Group \
+ { \
+ orientation: 'row', alignChildren:'center',\
+ okBtn: Button { text:'OK', properties:{name:'ok'}}, \
+ cancelBtn: Button { text:'Cancel', properties:{name:'cancel'}} \
+ } \
+ }\
+ } " );
+ // this allows only option groups for the chosen format to be shown
+ dia.info.format.chooser.onChange = function ()
+ {
+ if (this.selection != null)
+ {
+ for (var g = 0; g < this.items.length; g++)
+ this.items[g].group.visible = false; //hide all other groups
+ this.selection.group.visible = true;//show this group
+ }
+ }
+
+ //for the slider
+ dia.info.jpgOpts.quality.slide.onChanging = function()
+ {
+ dia.info.jpgOpts.quality.current.text = dia.info.jpgOpts.quality.slide.value;
+ }
+ dia.info.jpgOpts.quality.slide.onChange = dia.info.jpgOpts.quality.slide.onChanging;
+
+ dia.info.jpgOpts.quality.current.onChange = function()
+ {
+ var val = dia.info.jpgOpts.quality.current.text;
+ if (isNaN(val))
+ {
+ val = 60;
+ dia.info.jpgOpts.quality.current.text = val;
+ }
+ dia.info.jpgOpts.quality.slide.value = val;
+ }
+
+ //formats that can be exported to, and their options
+ var item = dia.info.format.chooser.add("item", "PNG");
+ item.group = dia.info.pngOpts;
+ item = dia.info.format.chooser.add("item", "JPEG");
+ item.group = dia.info.jpgOpts;
+ item = dia.info.format.chooser.add("item", "GIF");
+ item.group = dia.info.gifOpts;
+ item = dia.info.format.chooser.add("item", "PSD");
+ item.group = dia.info.psdOpts;
+ dia.info.format.chooser.selection = dia.info.format.chooser.items[0];
+
+ //directory chooser.
+ var base = sourceDoc.path;
+ Sheet.baseLocation = base.fsName;
+ dia.locPick.currentLoc.text = Sheet.baseLocation;
+ dia.locPick.bringDialog.onClick = function ()
+ {
+ var baseTemp = base.selectDlg();
+ if (baseTemp == null)
+ return ;
+ base = baseTemp;
+ Sheet.baseLocation = base.fsName;
+ dia.locPick.currentLoc.text = Sheet.baseLocation.toString();
+ dia.locPick.layout.resize();
+ }
+ dia.center();
+ result = dia.show();
+ if (result == 1)
+ {
+ //generate the options object using the results from the dialog.
+ var exportOpts = new ExportOptionsSaveForWeb();
+ Sheet.saveByExport = true;
+ switch (dia.info.format.chooser.selection.index)
+ {
+ case 0: //PNG
+ exportOpts.format = SaveDocumentType.PNG;
+ exportOpts.PNG8 = !dia.info.pngOpts.typeCheck.value;
+ break;
+ case 1: //JPEG
+ exportOpts.format = SaveDocumentType.JPEG;
+ exportOpts.quality = dia.info.jpgOpts.quality.slide.value;
+ break;
+ case 2: //GIF
+ exportOpts.format = SaveDocumentType.COMPUSERVEGIF;
+ break;
+ case 3: //PSD
+ Sheet.saveByExport = false;
+ break;
+ }
+ Sheet.opts = exportOpts;
+ Sheet.genXML = dia.genOpts.xmlCheck.value;
+ Sheet.useVariableSpaces = dia.genOpts.variablePlacing.value;
+ return true;
+ }
+ else
+ return false;
+}
+
+
+//New version! this one generates a spritesheet for each layer set (folder) of the document.
+//It asks for the location to store the generated spritesheets, and has a single log
+//file for positions and files of spritesheets from each folder.
+function main()
+{
+ app.preferences.rulerUnits = Units.PIXELS;
+ var sourceDoc = activeDocument;
+
+ //get options for exporting each generated sheet to PNG
+ gotOpts = getFormatOpts(sourceDoc);
+ if (!gotOpts)
+ return ;
+
+ //find out where to store everything.
+ Sheet.baseName = sourceDoc.name.substring(0, sourceDoc.name.lastIndexOf("."));
+
+ //text file stores positions of sprites in the sheets.
+ if (Sheet.genXML)
+ {
+ Sheet.posFile = new File(Sheet.baseLocation + "/" + Sheet.baseName + "-positions.xml", "TEXT");
+ Sheet.posFile.encoding = "UTF-8";
+ with (Sheet.posFile)
+ {
+ open("w");
+ writeln("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
+ writeln("<positions " + prop("name", Sheet.baseName) + " >");
+ }
+ }
+
+ var sheet;
+ var indent = " ";
+
+ //loop over each folder, generating sheets.
+ var count = sourceDoc.layerSets.length;
+ for (var i=0; i < count; i++)
+ {
+ with (new Sheet(sourceDoc.layerSets[i]))
+ {
+ createDoc(sourceDoc);
+ layout(indent);
+ saveOrExport();
+ close();
+ }
+ }
+ if (Sheet.genXML)
+ {
+ with (Sheet.posFile)
+ {
+ writeln("</positions>");
+ close();
+ }
+ }
+
+}
+main()
View
38 src/BeerMug.as
@@ -8,19 +8,45 @@ package
*/
public class BeerMug extends BarThing
{
- public static var COLOR1:uint = 0xff0000;
- public static var COLOR2:uint = 0xffff00;
- public static var SIZE:Number = 10;
+ public static var SIZE:Number = 25;
- public var full:Boolean;
+ private var _full:Boolean;
- public function BeerMug(initX:Number, initY:Number, leftBound:Number, rightBound:Number)
+ [Embed(source="../build/assets/beer_mug.png")]
+ private var BeerMugSprite:Class;
+
+ public function BeerMug(initX:Number, initY:Number, leftBound:Number, rightBound:Number, full:Boolean = true)
{
super(initX, initY, leftBound, rightBound);
- color = COLOR1;
+
+ this.full = full;
+
+ loadGraphic(BeerMugSprite, false, false, SIZE, SIZE);
+ addAnimation("idle",[0]);
+ addAnimation("fast",[1]);
+ addAnimation("empty",[2]);
+
collideRight = false;
collideLeft = true;
}
+ public function get full():Boolean
+ {
+ return _full;
+ }
+
+ public function set full(value:Boolean):void
+ {
+ _full = value;
+
+ if(value)
+ {
+ play("idle");
+ }
+ else
+ {
+ play("empty");
+ }
+ }
}
}
View
6 src/DeveloperHappyHour.as
@@ -8,19 +8,19 @@ package
import org.flixel.*;
- [SWF(width="800", height="480", backgroundColor="#000000")];
+ [SWF(width="800", height="480", backgroundColor="#000000", frameRate=30)];
[Frame(factoryClass="Preloader")];
/**
* start up the game. Create the level objects with all the settings for rising difficulty.
*/
public class DeveloperHappyHour extends FlxGame
{
- public static var WIDTH:int = 400, HEIGHT:int = 240;
+ public static var WIDTH:int = 800, HEIGHT:int = 480;
public function DeveloperHappyHour()
{
- super(WIDTH, HEIGHT, StartGameState);
+ super(WIDTH, HEIGHT, StartGameState, 1);
//this makes it easy ... incrementing FlxG.level to advance through the array.
FlxG.levels.push(new LevelSettings(1, 5));
FlxG.levels.push(new LevelSettings(1, 7));
View
12 src/Patron.as
@@ -11,7 +11,10 @@ package
{
public static var COLOR1:uint = 0x00ff00;
public static var COLOR2:uint = 0x00ffff;
- public static var SIZE:Number = 10;
+ public static var SIZE:Number = 40;
+
+ [Embed(source="../build/assets/patron_placeholder.png")]
+ private var PatronSprite:Class;
public var pushbackComplete:Function;
public var mugged:Function;
@@ -28,7 +31,12 @@ package
public function Patron(initX:Number, initY:Number, leftBound:Number, rightBound:Number)
{
super(initX, initY, leftBound, rightBound);
- color = COLOR1;
+
+ //TODO this needs to be cleaned up by the correct graphics
+ loadGraphic(PatronSprite, false, false, SIZE, 26);
+
+
+ //color = COLOR1;
collideLeft = false;
collideRight = true;
View
41 src/PlayState.as
@@ -4,6 +4,10 @@ package
public class PlayState extends FlxState
{
+ //Assets
+ [Embed(source="../build/assets/bar_background.png")]
+ private var BarSprite:Class;
+
//speeds
private var playerStep:Number = 2;
private var mugSpeed:Number = 100;
@@ -71,6 +75,10 @@ package
*/
override public function create():void
{
+
+ //create bar background
+ add(new FlxSprite(0, 0, BarSprite));
+
FlxG.mouse.hide();
//set life count
@@ -95,17 +103,18 @@ package
tapperPositions = new Array();
mugPositions = new Array();
patronPositions = new Array();
-
- bars[0] = new FlxRect(10, 50, 380, 10);
- bars[1] = new FlxRect(10, 110, 380, 10);
- bars[2] = new FlxRect(10, 170, 380, 10);
-
- var barShow:FlxSprite;
+
+ bars[0] = new FlxRect(207, 133, 350, 37);
+ bars[1] = new FlxRect(172, 209, 414, 37);
+ bars[2] = new FlxRect(144, 284, 480, 37);
+ bars[3] = new FlxRect(113, 360, 547, 37);
+
+ //var barShow:FlxSprite;
// generate the bar groups and position arrays.
for (var i:int = 0; i < bars.length; i++)
{
- barShow = new FlxSprite(bars[i].x, bars[i].y).createGraphic(bars[i].width, bars[i].height);
- add(barShow);
+ //barShow = new FlxSprite(bars[i].x, bars[i].y).createGraphic(bars[i].width, bars[i].height);
+ //add(barShow);
barMugs[i] = new FlxGroup();
add(barMugs[i]);
@@ -116,9 +125,9 @@ package
moneyOnBars[i] = new FlxGroup();
add(moneyOnBars[i]);
- tapperPositions[i] = new FlxPoint(bars[i].right, bars[i].top);
- mugPositions[i] = new FlxPoint(bars[i].right - BeerMug.SIZE, bars[i].top);
- patronPositions[i] = new FlxPoint(bars[i].left, bars[i].top);
+ tapperPositions[i] = new FlxPoint(bars[i].right-7, bars[i].top - 8);
+ mugPositions[i] = new FlxPoint(bars[i].right - BeerMug.SIZE, bars[i].top-20);
+ patronPositions[i] = new FlxPoint(bars[i].left, bars[i].top - 27);
}
player = new Player(tapperPositions[0]);
@@ -181,7 +190,7 @@ package
}
else
{ //found one, make sure that it looks like a new one
- mug.color = BeerMug.COLOR1;
+ //mug.color = BeerMug.COLOR1;
mug.startPos = pos;
}
mug.full = true;
@@ -266,7 +275,7 @@ package
{ //get the one we found set up right.
patron.inPushBack = false;
patron.startPos = pos;
- patron.color = Patron.COLOR1;
+ //patron.color = Patron.COLOR1;
}
//send it along
patron.prepare();
@@ -301,7 +310,7 @@ package
mug.kill();
patron.velocity.x = 0;
patron.velocity.y = 0;
- patron.color = Patron.COLOR2;
+ //patron.color = Patron.COLOR2;
//push back patron, and let it animate. when it finishes, it'll call pushbackComplete
patron.inPushBack = true;
patron.collideRight = false;
@@ -318,7 +327,7 @@ package
*/
public function pushbackComplete(patron:Patron):void
{
- patron.color = Patron.COLOR1;
+ //patron.color = Patron.COLOR1;
patron.velocity.x = patronSpeed;
//we'll need these references soon.
@@ -341,7 +350,7 @@ package
else
mug.startPos = pos;
mug.full = false;
- mug.color = BeerMug.COLOR2;
+ //mug.color = BeerMug.COLOR2;
mug.prepare();
mug.velocity.x = mugSpeed / 2;
View
11 src/Player.as
@@ -4,11 +4,18 @@ package
public class Player extends FlxSprite
{
+ [Embed(source="../build/assets/bartender_placeholder.png")]
+ private var BartenderSprite:Class;
+
public function Player(pos:FlxPoint)
{
super(pos.x, pos.y);
- createGraphic(10,20);
- color = 0x0000ff;
+
+ //TODO this needs to be cleaned up by the correct graphics
+ loadGraphic(BartenderSprite, false, false, 32, 51);
+
+ //createGraphic(10,20);
+ //color = 0x0000ff;
}
override public function update():void
View
25 src/StartGameState.as
@@ -9,20 +9,31 @@ package
{
private var title:FlxText;
private var prompter:FlxText;
-
+
+ [Embed(source="../build/assets/opening_screen.png")]
+ private var TitleSprite:Class;
+
+ [Embed(source="../build/assets/opening_screen_animation.png")]
+ private var BeerMugSprite:Class;
+
override public function create():void
{
+
+ add(new FlxSprite(0,0,TitleSprite));
+
+ var mug:FlxSprite = new FlxSprite(430,151);
+ mug.loadGraphic(BeerMugSprite,true, false, 118,166);
+ mug.addAnimation("fill", [0,1,2,3,4,5,6,7,8,9,10], 5, false);
+ add(mug);
+
FlxG.mouse.show();
+
//reset level and score.
FlxG.level = 0;
FlxG.score = 0;
- title = new FlxText(0, 60, 400, "Developer Happy Hour");
- title.setFormat(null, 12, 0xffffff, "center", 0);
- add(title);
- prompter = new FlxText(0, 120, 400, "Click to start");
- prompter.setFormat(null, 8, 0xffffff, "center", 0);
- add(prompter);
+ //TODO This should be on a timer
+ mug.play("fill");
}
override public function update():void

0 comments on commit d0c3e22

Please sign in to comment.
Something went wrong with that request. Please try again.