Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add level select screen

  • Loading branch information...
commit 0582eed88ff5e768f645ca4201ceca14d5cec37c 1 parent 1cd86f2
Roger Braun rogerbraun authored
BIN  assets/Levels/LevelSelect/LevelSelect.png
BIN  assets/Levels/LevelSelect/LevelSelect.tps
Binary file not shown
23 assets/Levels/LevelSelect/LevelSelect.xml
... ... @@ -0,0 +1,23 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!-- Created with TexturePacker http://texturepacker.com-->
  3 +<!-- $TexturePacker:SmartUpdate:1ba22cfba1fd06359191c28cda890deb$ -->
  4 +<TextureAtlas imagePath="LevelSelect.png">
  5 + <SubTexture name="header_15-20" x="2" y="158" width="931" height="152"/>
  6 + <SubTexture name="info-level" x="436" y="661" width="810" height="550"/>
  7 + <SubTexture name="text-info-level1" x="833" y="2" width="596" height="76"/>
  8 + <SubTexture name="text-info-level2" x="325" y="80" width="371" height="76"/>
  9 + <SubTexture name="text-info-level3" x="1066" y="80" width="451" height="76"/>
  10 + <SubTexture name="text-info-level4" x="1431" y="2" width="516" height="76"/>
  11 + <SubTexture name="text-info-level5" x="698" y="80" width="366" height="76"/>
  12 + <SubTexture name="text-info-level6" x="415" y="2" width="416" height="66"/>
  13 + <SubTexture name="text-info-level7" x="2" y="80" width="321" height="76"/>
  14 + <SubTexture name="text-info-level8" x="2" y="2" width="411" height="66"/>
  15 + <SubTexture name="tile-boss_54-1190" x="1248" y="661" width="785" height="962"/>
  16 + <SubTexture name="tile-level1_15-262" x="935" y="158" width="432" height="236"/>
  17 + <SubTexture name="tile-level2_261-377" x="882" y="399" width="432" height="248"/>
  18 + <SubTexture name="tile-level3_514-509" x="2" y="399" width="432" height="242"/>
  19 + <SubTexture name="tile-level4_261-626" x="2" y="661" width="432" height="378"/>
  20 + <SubTexture name="tile-level5_11-743" x="1316" y="399" width="432" height="260"/>
  21 + <SubTexture name="tile-level6_261-890" x="1369" y="158" width="436" height="239"/>
  22 + <SubTexture name="tile-level7_515-1009" x="436" y="399" width="444" height="248"/>
  23 +</TextureAtlas>
BIN  assets/Levels/LevelSelect/background.png
BIN  assets/Menus/Menu.png
BIN  assets/Menus/Menu.tps
Binary file not shown
41 assets/Menus/Menu.xml
... ... @@ -0,0 +1,41 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!-- Created with TexturePacker http://texturepacker.com-->
  3 +<!-- $TexturePacker:SmartUpdate:e26f9135cdbe5d1ea1ae8c36d07372e1$ -->
  4 +<TextureAtlas imagePath="Menu.png">
  5 + <SubTexture name="abbca" x="452" y="139" width="88" height="88"/>
  6 + <SubTexture name="abcb" x="272" y="139" width="88" height="88"/>
  7 + <SubTexture name="acba" x="92" y="139" width="88" height="88"/>
  8 + <SubTexture name="bcaac" x="182" y="139" width="88" height="88"/>
  9 + <SubTexture name="bccb" x="2" y="139" width="88" height="88"/>
  10 + <SubTexture name="ccbba" x="362" y="139" width="88" height="88"/>
  11 + <SubTexture name="combo-boost" x="382" y="234" width="93" height="93"/>
  12 + <SubTexture name="combo-brake" x="477" y="234" width="93" height="93"/>
  13 + <SubTexture name="combo-chaintime" x="287" y="234" width="93" height="93"/>
  14 + <SubTexture name="combo-gold" x="542" y="139" width="93" height="93"/>
  15 + <SubTexture name="combo-leveluptime" x="732" y="139" width="93" height="93"/>
  16 + <SubTexture name="combo-rotteneggs" x="97" y="234" width="93" height="93"/>
  17 + <SubTexture name="combo-shuffle" x="192" y="234" width="93" height="93"/>
  18 + <SubTexture name="combo-special" x="572" y="234" width="93" height="93"/>
  19 + <SubTexture name="combo-speed" x="637" y="139" width="93" height="93"/>
  20 + <SubTexture name="combo-time" x="922" y="139" width="93" height="93"/>
  21 + <SubTexture name="combo-xtralife" x="2" y="234" width="93" height="93"/>
  22 + <SubTexture name="combo-xtraspawn" x="827" y="139" width="93" height="93"/>
  23 + <SubTexture name="combo_abbca" x="565" y="67" width="105" height="65"/>
  24 + <SubTexture name="combo_abcb" x="458" y="67" width="105" height="65"/>
  25 + <SubTexture name="combo_acba" x="672" y="67" width="105" height="65"/>
  26 + <SubTexture name="combo_bcaac" x="244" y="67" width="105" height="65"/>
  27 + <SubTexture name="combo_bccb" x="351" y="67" width="105" height="65"/>
  28 + <SubTexture name="combo_ccbba" x="779" y="67" width="105" height="65"/>
  29 + <SubTexture name="info-button" x="886" y="67" width="70" height="70"/>
  30 + <SubTexture name="loading" x="2" y="336" width="960" height="640"/>
  31 + <SubTexture name="pleaseswipeup" x="667" y="234" width="300" height="100"/>
  32 + <SubTexture name="text-arcade" x="574" y="33" width="215" height="32"/>
  33 + <SubTexture name="text-no" x="249" y="2" width="40" height="18"/>
  34 + <SubTexture name="text-purchase" x="64" y="2" width="183" height="18"/>
  35 + <SubTexture name="text-settings" x="2" y="67" width="240" height="32"/>
  36 + <SubTexture name="text-story" x="394" y="33" width="178" height="32"/>
  37 + <SubTexture name="text-yes" x="2" y="2" width="60" height="18"/>
  38 + <SubTexture name="text_arcade mode" x="291" y="2" width="352" height="29"/>
  39 + <SubTexture name="text_leaderboards" x="2" y="33" width="390" height="29"/>
  40 + <SubTexture name="text_play" x="645" y="2" width="124" height="29"/>
  41 +</TextureAtlas>
28 src/Level/LevelState.as
@@ -32,6 +32,8 @@ package Level
32 32 import flash.events.GestureEvent;
33 33 import flash.events.TransformGestureEvent;
34 34 import flash.media.Sound;
  35 + import flash.events.Event;
  36 + import flash.media.SoundTransform;
35 37
36 38 /**
37 39 * ...
@@ -61,13 +63,25 @@ package Level
61 63 private var _following:Snake.Head;
62 64 private var _possibleSwipe:Boolean = false;
63 65 private var _swipeY:int;
64   - private var _swipeMenu:Quad;
  66 + private var _swipeMenu:Sprite;
65 67 private var _paused:Boolean = false;
66 68
  69 + private static const sfx:Sound = new AssetRegistry.WinMusic() as Sound;
  70 +
  71 + private static const SilentSoundTransform:SoundTransform = new SoundTransform(0);
  72 +
  73 + private static function playSoundSilentlyEndlessly(evt:Event = null):void
  74 + {
  75 + sfx.play(0, 1000, SilentSoundTransform).addEventListener(Event.SOUND_COMPLETE, playSoundSilentlyEndlessly, false, 0, true); // plays the sound with volume 0 endlessly
  76 + }
  77 +
  78 +
67 79 public function LevelState()
68 80 {
69 81 super();
70   - AssetRegistry.init();
  82 +
  83 + // Fix for laggy sound
  84 + playSoundSilentlyEndlessly();
71 85
72 86 _currentCombos = null;
73 87
@@ -114,8 +128,11 @@ package Level
114 128 _text.hAlign = HAlign.LEFT;
115 129 addChild(_text);
116 130
117   - _swipeMenu = new Quad(Starling.current.viewPort.width, 100, 0x000000);
118   - _swipeMenu.alpha = 0.3;
  131 + _swipeMenu = new Sprite();
  132 + var swipeBackground:Quad = new Quad(Starling.current.viewPort.width, 100, 0x000000);
  133 + swipeBackground.alpha = 0.3;
  134 +
  135 + _swipeMenu.addChild(swipeBackground);
119 136 _swipeMenu.y = Starling.current.viewPort.height;
120 137 addChild(_swipeMenu);
121 138
@@ -145,8 +162,7 @@ package Level
145 162 {
146 163 new GTween(this, 0.5, {zoom: 5});
147 164 new GTween(Starling.juggler, 0.5, { timeFactor: 0.1 } );
148   - var ode:Sound = new AssetRegistry.WinMusic as Sound;
149   - ode.play();
  165 + AssetRegistry.WinMusicSound.play();
150 166 }
151 167 }
152 168
3  src/Main.as
@@ -14,6 +14,7 @@ package
14 14 import starling.core.Starling;
15 15 import fr.kouma.starling.utils.Stats;
16 16 import Level.*;
  17 + import engine.StageManager;
17 18
18 19 /**
19 20 * ...
@@ -38,7 +39,7 @@ package
38 39
39 40 // entry point
40 41
41   - starling = new Starling(ArcadeState, stage, new Rectangle(0, 0, 960, 640));
  42 + starling = new Starling(StageManager, stage, new Rectangle(0, 0, 960, 640));
42 43
43 44 var loadingSprite:Sprite = new Sprite()
44 45 var loadingBMP:Bitmap = new AssetRegistry.LoadingPNG();
161 src/Menu/LevelSelect.as
... ... @@ -0,0 +1,161 @@
  1 +package Menu
  2 +{
  3 + import flash.geom.Point;
  4 + import starling.display.DisplayObject;
  5 + import starling.display.Image;
  6 + import starling.display.Quad;
  7 + import starling.display.Sprite;
  8 + import engine.AssetRegistry;
  9 + import starling.events.Touch;
  10 + import starling.events.TouchEvent;
  11 + import starling.events.TouchPhase;
  12 + import starling.core.Starling;
  13 +
  14 + /**
  15 + * ...
  16 + * @author
  17 + */
  18 + public class LevelSelect extends Sprite
  19 + {
  20 + private var _bg:Quad;
  21 + private var _levelInfo:Sprite;
  22 + private var _showingInfo:Boolean;
  23 + private var _levelName:Image;
  24 + private var _scrollable:Sprite;
  25 + private var _slideY:Number = 0;
  26 +
  27 + public function LevelSelect()
  28 + {
  29 + _scrollable = new Sprite();
  30 + _scrollable.addEventListener(TouchEvent.TOUCH, onTouch);
  31 + _levelInfo = new Sprite();
  32 + _showingInfo = false;
  33 + _levelName = new Image(AssetRegistry.LevelSelectAtlas.getTexture("text-info-level1"));
  34 +
  35 + _bg = new Quad(960, 2240, 0xCDB594);
  36 + _scrollable.addChild(_bg);
  37 +
  38 + var header:Image = new Image(AssetRegistry.LevelSelectAtlas.getTexture("header_15-20"));
  39 + header.x = 15;
  40 + header.y = 20;
  41 + _scrollable.addChild(header);
  42 +
  43 + var level1:Image = new Image(AssetRegistry.LevelSelectAtlas.getTexture("tile-level1_15-262"));
  44 + level1.x = 15;
  45 + level1.y = 262;
  46 + level1.addEventListener(TouchEvent.TOUCH, showLevelInfo(1));
  47 + _scrollable.addChild(level1);
  48 +
  49 + var level2:Image = new Image(AssetRegistry.LevelSelectAtlas.getTexture("tile-level2_261-377"));
  50 + level2.x = 261;
  51 + level2.y = 377;
  52 + level2.alpha = 0.5;
  53 + level2.addEventListener(TouchEvent.TOUCH, showLevelInfo(2));
  54 +
  55 + _scrollable.addChild(level2);
  56 +
  57 + var level3:Image = new Image(AssetRegistry.LevelSelectAtlas.getTexture("tile-level3_514-509"));
  58 + level3.x = 514;
  59 + level3.y = 509;
  60 + level3.alpha = 0.5;
  61 + level3.addEventListener(TouchEvent.TOUCH, showLevelInfo(3));
  62 +
  63 + _scrollable.addChild(level3);
  64 +
  65 + var level4:Image = new Image(AssetRegistry.LevelSelectAtlas.getTexture("tile-level4_261-626"));
  66 + level4.x = 261;
  67 + level4.y = 626;
  68 + level4.alpha = 0.5;
  69 + level4.addEventListener(TouchEvent.TOUCH, showLevelInfo(4));
  70 +
  71 + _scrollable.addChild(level4);
  72 +
  73 + var level5:Image = new Image(AssetRegistry.LevelSelectAtlas.getTexture("tile-level5_11-743"));
  74 + level5.x = 11;
  75 + level5.y = 743;
  76 + level5.alpha = 0.5;
  77 + level5.addEventListener(TouchEvent.TOUCH, showLevelInfo(5));
  78 +
  79 + _scrollable.addChild(level5);
  80 +
  81 + var level6:Image = new Image(AssetRegistry.LevelSelectAtlas.getTexture("tile-level6_261-890"));
  82 + level6.x = 261;
  83 + level6.y = 890;
  84 + level6.alpha = 0.5;
  85 + level6.addEventListener(TouchEvent.TOUCH, showLevelInfo(6));
  86 +
  87 + _scrollable.addChild(level6);
  88 +
  89 + var level7:Image = new Image(AssetRegistry.LevelSelectAtlas.getTexture("tile-level7_515-1009"));
  90 + level7.x = 515;
  91 + level7.y = 1009;
  92 + level7.alpha = 0.5;
  93 + level7.addEventListener(TouchEvent.TOUCH, showLevelInfo(7));
  94 +
  95 + _scrollable.addChild(level7);
  96 +
  97 + var level8:Image = new Image(AssetRegistry.LevelSelectAtlas.getTexture("tile-boss_54-1190"));
  98 + level8.x = 54;
  99 + level8.y = 1190;
  100 + level8.alpha = 0.5;
  101 + level8.addEventListener(TouchEvent.TOUCH, showLevelInfo(8));
  102 +
  103 + _scrollable.addChild(level8);
  104 +
  105 + addChild(_scrollable);
  106 +
  107 + }
  108 +
  109 + private function showLevelInfo(level:int):Function
  110 + {
  111 + var that:Sprite = this;
  112 + return function(event:TouchEvent):void
  113 + {
  114 + if (!_showingInfo)
  115 + {
  116 + var touch:Touch = event.getTouch(that, TouchPhase.ENDED)
  117 + if (touch)
  118 + {
  119 + if (_slideY < 50)
  120 + {
  121 + _levelInfo.addChild(new Image(AssetRegistry.LevelSelectAtlas.getTexture("info-level")));
  122 + _levelInfo.x = (Starling.current.viewPort.width - _levelInfo.width) / 2;
  123 + _levelInfo.y = (Starling.current.viewPort.height - _levelInfo.height) / 2;
  124 + _levelName.texture = AssetRegistry.LevelSelectAtlas.getTexture("text-info-level" + String(level));
  125 + _levelInfo.addChild(_levelName);
  126 +
  127 + _levelName.x += 85;
  128 + _levelName.y += 85;
  129 +
  130 + that.addChild(_levelInfo);
  131 +
  132 + _showingInfo = true;
  133 + }
  134 + } else {
  135 + touch = event.getTouch(that, TouchPhase.BEGAN);
  136 + if (touch) {
  137 + _slideY = 0;
  138 + }
  139 + }
  140 + }
  141 + }
  142 + }
  143 +
  144 + private function onTouch(event:TouchEvent):void
  145 + {
  146 + if (!_showingInfo)
  147 + {
  148 + var touch:Touch = event.getTouch(_scrollable, TouchPhase.MOVED);
  149 + if (touch)
  150 + {
  151 + _slideY += Math.abs(touch.getMovement(_scrollable).y);
  152 + _scrollable.y += touch.getMovement(_scrollable).y;
  153 + _scrollable.y = Math.min(0, _scrollable.y);
  154 + _scrollable.y = Math.max(-(_bg.height - Starling.current.viewPort.height), _scrollable.y);
  155 + }
  156 + }
  157 + }
  158 +
  159 + }
  160 +
  161 +}
129 src/Menu/MainMenu.as
... ... @@ -0,0 +1,129 @@
  1 +package Menu
  2 +{
  3 + import Level.ArcadeState;
  4 + import starling.display.Image;
  5 + import starling.display.Sprite;
  6 + import engine.AssetRegistry;
  7 + import starling.events.TouchEvent;
  8 + import starling.core.Starling;
  9 + import starling.display.Quad;
  10 + import starling.events.TouchPhase;
  11 + import starling.events.Touch;
  12 + import com.gskinner.motion.GTween;
  13 + import engine.StageManager;
  14 +
  15 + /**
  16 + * ...
  17 + * @author
  18 + */
  19 + public class MainMenu extends Sprite
  20 + {
  21 + private var _bg:Image;
  22 + private var _possibleSwipe:Boolean = false;
  23 + private var _swipeY:int = 0;
  24 + private var _swipeMenu:Sprite;
  25 + private var _swipeMessage:Image;
  26 +
  27 +
  28 + public function MainMenu()
  29 + {
  30 + this.addEventListener(TouchEvent.TOUCH, onTouch);
  31 +
  32 + _bg = new Image(AssetRegistry.MenuAtlas.getTexture("loading"));
  33 + addChild(_bg);
  34 +
  35 + _swipeMenu = new Sprite();
  36 +
  37 + var menuBG:Quad = new Quad(Starling.current.viewPort.width, 100, 0x000000);
  38 + menuBG.alpha = 0.3;
  39 + _swipeMenu.addChild(menuBG);
  40 +
  41 + _swipeMenu.y = Starling.current.viewPort.height;
  42 +
  43 + var arcadeButton:Image = new Image(AssetRegistry.MenuAtlas.getTexture("text-arcade"));
  44 + arcadeButton.x = 22;
  45 + arcadeButton.y = (_swipeMenu.height - arcadeButton.height) / 2;
  46 +
  47 + arcadeButton.addEventListener(TouchEvent.TOUCH, startArcade);
  48 + _swipeMenu.addChild(arcadeButton);
  49 +
  50 +
  51 + var levelSelectButton:Image = new Image(AssetRegistry.MenuAtlas.getTexture("text-story"));
  52 + levelSelectButton.x = 389;
  53 + levelSelectButton.y = arcadeButton.y;
  54 +
  55 + levelSelectButton.addEventListener(TouchEvent.TOUCH, startLevelSelect);
  56 +
  57 + _swipeMenu.addChild(levelSelectButton);
  58 +
  59 + _swipeMenu.flatten();
  60 +
  61 + addChild(_swipeMenu);
  62 +
  63 + _swipeMessage = new Image(AssetRegistry.MenuAtlas.getTexture("pleaseswipeup"));
  64 + _swipeMessage.x = (Starling.current.viewPort.width - _swipeMessage.width) / 2;
  65 + _swipeMessage.y = (Starling.current.viewPort.height - _swipeMessage.height) / 2;
  66 + _swipeMessage.alpha = 0;
  67 +
  68 + addChild(_swipeMessage);
  69 +
  70 + Starling.juggler.delayCall(function():void { new GTween(_swipeMessage, 1, {alpha: 1})}, 2);
  71 +
  72 + }
  73 +
  74 + private function startArcade(event:TouchEvent):void {
  75 + var touch:Touch = event.getTouch(this, TouchPhase.ENDED);
  76 + if (touch && _swipeMenu.y == Starling.current.viewPort.height - _swipeMenu.height) {
  77 + AssetRegistry.loadArcadeGraphics();
  78 + StageManager.switchStage(new ArcadeState);
  79 + }
  80 + }
  81 +
  82 + private function startLevelSelect(event:TouchEvent):void {
  83 + var touch:Touch = event.getTouch(this, TouchPhase.ENDED);
  84 + if (touch && _swipeMenu.y == Starling.current.viewPort.height - _swipeMenu.height) {
  85 + AssetRegistry.loadLevelSelectGraphics();
  86 + StageManager.switchStage(new LevelSelect);
  87 + }
  88 + }
  89 +
  90 + private function onTouch(event:TouchEvent):void
  91 + {
  92 + var touch:Touch = event.getTouch(this, TouchPhase.BEGAN);
  93 + if (touch)
  94 + {
  95 + if (touch.getLocation(this).y > 400)
  96 + {
  97 + trace("Possible swipe!");
  98 + _possibleSwipe = true;
  99 + _swipeY = touch.getLocation(this).y;
  100 + }
  101 + else
  102 + {
  103 + _possibleSwipe = false;
  104 +
  105 + }
  106 + }
  107 + else
  108 + {
  109 + touch = event.getTouch(this, TouchPhase.ENDED);
  110 + if (touch)
  111 + {
  112 + if (_possibleSwipe && Math.abs((_swipeY - touch.getLocation(this).y)) > 50)
  113 + {
  114 + trace("Swipe!");
  115 + if (_swipeMenu.y == Starling.current.viewPort.height && _swipeY > touch.getLocation(this).y)
  116 + {
  117 + new GTween(_swipeMenu, 0.2, {"y": Starling.current.viewPort.height - _swipeMenu.height});
  118 + }
  119 + else if (_swipeMenu.y == Starling.current.viewPort.height - _swipeMenu.height && _swipeY < touch.getLocation(this).y)
  120 + {
  121 + new GTween(_swipeMenu, 0.2, {"y": Starling.current.viewPort.height});
  122 + }
  123 + }
  124 + }
  125 + }
  126 + }
  127 + }
  128 +
  129 +}
46 src/engine/AssetRegistry.as
... ... @@ -1,5 +1,6 @@
1 1 package engine
2 2 {
  3 + import flash.media.Sound;
3 4 import starling.text.BitmapFont;
4 5 import starling.textures.Texture;
5 6 import starling.textures.TextureAtlas;
@@ -26,14 +27,26 @@ package engine
26 27 [Embed(source="../../assets/Levels/arcadeoverlaytexture.xml", mimeType="application/octet-stream")] static private const ArcadeOverlayAtlasXML:Class
27 28 [Embed(source = "../../assets/Levels/arcadeoverlaytexture.png")] static private const ArcadeOverlayAtlasPNG:Class;
28 29
  30 + [Embed(source = "../../assets/Menus/Menu.xml", mimeType="application/octet-stream")] static private const MenuXML:Class;
  31 + [Embed(source = "../../assets/Menus/Menu.png")] static private const MenuPNG:Class;
  32 +
  33 + [Embed(source = "../../assets/Levels/LevelSelect/LevelSelect.xml", mimeType = "application/octet-stream")] static private const LevelSelectXML:Class;
  34 + [Embed(source = "../../assets/Levels/LevelSelect/LevelSelect.png")] static private const LevelSelectPNG:Class;
  35 + [Embed(source = "../../assets/Levels/LevelSelect/background.png")] static private const LevelSelectBGPNG:Class;
  36 +
29 37 public static var SnakeAtlas:TextureAtlas;
  38 + public static var MenuAtlas:TextureAtlas;
30 39 public static var ArcadeOverlayAtlas:TextureAtlas;
  40 + public static var LevelSelectAtlas:TextureAtlas;
  41 +
31 42 public static var UIOverlayTexture:Texture;
  43 + public static var LevelSelectBGTexture:Texture;
32 44 public static var DrugParticleConfig:XML;
33 45 public static var DrugParticleTexture:Texture;
34 46 public static var ArcadeBackground:Texture;
35 47 public static var ArcadeOverlay:Texture;
36 48 public static var Level1Background:Texture;
  49 + public static var WinMusicSound:Sound;
37 50
38 51 public static const TILESIZE:int = 15;
39 52
@@ -50,28 +63,43 @@ package engine
50 63 public static const EGGSHUFFLE:int = 5;
51 64 public static const EGGGOLDEN:int = 6;
52 65
53   - public static var HQ:Boolean = true;
  66 + public static var HQ:Boolean = false;
54 67
55 68 public static function init():void
56 69 {
57   -
58   - UIOverlayTexture = Texture.fromBitmap(new UIOverlayPNG);
59   - ArcadeBackground = Texture.fromBitmap(new ArcadeBackgroundPNG);
60   - ArcadeOverlay = Texture.fromBitmap(new ArcadeOverlayPNG);
  70 + TextField.registerBitmapFont(new BitmapFont(Texture.fromBitmap(new FontPNG()), XML(new FontXML)));
  71 + MenuAtlas = new TextureAtlas(Texture.fromBitmap(new MenuPNG), XML(new MenuXML));
  72 +
  73 + /*
  74 +
61 75
62 76 Level1Background = Texture.fromBitmap(new Level1BackgroundPNG);
63 77
64 78 var texture:Texture = Texture.fromBitmap(new SnakeTexturePNG);
65   - SnakeAtlas = new TextureAtlas(texture, XML(new SnakeAtlasXML));
66 79
  80 +
  81 + */
  82 + }
  83 +
  84 + public static function loadArcadeGraphics():void {
  85 + UIOverlayTexture = Texture.fromBitmap(new UIOverlayPNG);
  86 + ArcadeBackground = Texture.fromBitmap(new ArcadeBackgroundPNG);
  87 + SnakeAtlas = new TextureAtlas(Texture.fromBitmap(new SnakeTexturePNG), XML(new SnakeAtlasXML));
67 88 ArcadeOverlayAtlas = new TextureAtlas(Texture.fromBitmap(new ArcadeOverlayAtlasPNG), XML(new ArcadeOverlayAtlasXML));
68 89
69 90 DrugParticleConfig = XML(new DrugsParticleXML);
70   - DrugParticleTexture = Texture.fromBitmap(new DrugsParticlePNG);
71   -
72   - TextField.registerBitmapFont(new BitmapFont(Texture.fromBitmap(new FontPNG()), XML(new FontXML)));
  91 + DrugParticleTexture = Texture.fromBitmap(new DrugsParticlePNG);
  92 + WinMusicSound = new WinMusic as Sound;
73 93
74 94 }
  95 +
  96 + public static function loadLevelSelectGraphics():void {
  97 + LevelSelectAtlas = new TextureAtlas(Texture.fromBitmap(new LevelSelectPNG), XML(new LevelSelectXML));
  98 + }
  99 +
  100 + public static function disposeLevelSelectGraphics():void {
  101 + LevelSelectAtlas.dispose();
  102 + }
75 103
76 104 }
77 105
33 src/engine/StageManager.as
... ... @@ -0,0 +1,33 @@
  1 +package engine
  2 +{
  3 + import starling.display.Sprite;
  4 + import Menu.MainMenu;
  5 +
  6 + /**
  7 + * ...
  8 + * @author
  9 + */
  10 + public class StageManager extends Sprite
  11 + {
  12 +
  13 + private static var _currentSprite:Sprite;
  14 + private static var _manager:StageManager;
  15 +
  16 + public function StageManager()
  17 + {
  18 + _manager = this;
  19 + AssetRegistry.init();
  20 + switchStage(new MainMenu);
  21 + }
  22 +
  23 + public static function switchStage(newStage:Sprite):void {
  24 + if (_currentSprite != null) {
  25 + _manager.removeChild(_currentSprite);
  26 + }
  27 + _currentSprite = newStage;
  28 + _manager.addChild(newStage);
  29 + }
  30 +
  31 + }
  32 +
  33 +}
1  src/engine/TileSprite.as
@@ -149,6 +149,7 @@ package engine
149 149 facing = value;
150 150 }
151 151
  152 +
152 153 }
153 154
154 155 }
2  src/starling/core/Starling.as
@@ -266,8 +266,8 @@ package starling.core
266 266 var passedTime:Number = now - mLastFrameTimestamp;
267 267 mLastFrameTimestamp = now;
268 268
  269 + mJuggler.advanceTime(passedTime);
269 270 mStage.advanceTime(passedTime);
270   - mJuggler.advanceTime(passedTime);
271 271 mTouchProcessor.advanceTime(passedTime);
272 272 }
273 273

0 comments on commit 0582eed

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