Skip to content

Commit

Permalink
make level 3 work
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerbraun committed May 8, 2012
1 parent 6352ca4 commit b5d62a8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 51 deletions.
66 changes: 18 additions & 48 deletions Level3.as
Original file line number Diff line number Diff line change
@@ -1,56 +1,32 @@
package {
import org.flixel.*;
import org.flixel.plugin.photonstorm.*;
import org.flixel.plugin.photonstorm.FX.*;
import org.axgl.*;
import org.axgl.text.*;

public class Level3 extends LevelState {
// Assets
[Embed(source='assets/images/level02bg.jpg')] protected var Background:Class;
[Embed(source='assets/images/level3bg.png')] protected var Background:Class;
// Variablen
protected var _background:FlxSprite = null;
protected var _hudText:FlxText;
private var _snakePlasma:PlasmaFX;
private var _snakePlasmaSprite:FlxSprite;

private var _snakeGlitch:GlitchFX;
//private var _snakeStar:StarfieldFX;
//private var _snakeStarSprite:FlxSprite;

override public function create():void {
super.create();
if (FlxG.getPlugin(FlxSpecialFX) == null)
{
FlxG.addPlugin(new FlxSpecialFX);
}

// _snakeStar = FlxSpecialFX.starfield();
// _snakeStar.setBackgroundColor(0x00);
// _snakeStarSprite = _snakeStar.create(0, 0, 640, 480);
_snakePlasma = FlxSpecialFX.plasma();
_snakePlasmaSprite = _snakePlasma.create(0,0,160,120,8,8);

add(_snakePlasmaSprite);
// add(_snakeStarSprite);
}
protected var _background:AxSprite = null;
protected var _hudText:AxText;

override protected function addBackgrounds():void {
_background = new FlxSprite(0,0);
_background.loadGraphic(Background);
_snakeGlitch = FlxSpecialFX.glitch();
_background = _snakeGlitch.createFromFlxSprite(_background, 10, 10, true);
_snakeGlitch.start(2);

_background = new AxSprite(0,0);
_background.load(Background, 640, 480);
_background.addAnimation('morph',[0,1],8);
_background.animate('morph');
add(_background);
}

override protected function addObstacles():void {
var stone:FlxSprite = new FlxSprite(180,225);
stone.makeGraphic(75,45,0x00ff0000);
/*
var stone:AxSprite = new AxSprite(180,225);
stone.create(75,45,0x00ff0000);
_obstacles.add(stone);
stone = new FlxSprite(195,240);
stone.makeGraphic(75,45,0x000000ff);
stone = new AxSprite(195,240);
stone.create(75,45,0x000000ff);
_obstacles.add(stone);
add(_obstacles);
*/
}

override protected function spawnFood():void {
Expand All @@ -67,15 +43,14 @@ package {
}

override protected function addHud():void {
_hudText = new FlxText(15,15, 640 - 60, "Nothing yet...");
_hudText.size = 16;
_hudText = new AxText(15,15, null, "Nothing yet...");
add(_hudText);
}

override protected function checkWinConditions():void {
if(_combos >= 10 || _eggAmount >= 100 || _timerMin >= 4) {
var switcher:SwitchLevel = new SwitchLevel("Conglaturation !!!\nYou have completed a great game.\nAnd prooved the justice of our culture.\nNow go and rest our heroes !", Level3, Level3, "111");
FlxG.switchState(switcher);
Ax.switchState(switcher);
}
}

Expand All @@ -86,10 +61,9 @@ package {
}

override protected function levelOver():void {
FlxG.score = _score;
_switchLevel = new SwitchLevel("You failed!\nTry again", Level3, Level3, _timerHud);
_switchLevel.gameOver();
FlxG.switchState(_switchLevel);
Ax.switchState(_switchLevel);

}

Expand All @@ -109,9 +83,5 @@ package {
return res.filter(largerThanThree);
}

override public function destroy():void {
FlxSpecialFX.clear();
super.destroy();
}
}
}
6 changes: 3 additions & 3 deletions LevelSelect.as
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package {
private static var _level1:Array = [Level1, "Level1", "Crossroads of Carnage", "Devour 50 Eggs", "None"];
private static var _level2:Array = [Level2, "Level2", "Make 20 Combos of 3(or more if you dare)", "None"];

private static var _level3:Array = [Level2, "Level3", "Snaking on Speed", "Survive the Food Poisoning", "None"];
private static var _level3:Array = [Level3, "Level3", "Snaking on Speed", "Survive the Food Poisoning", "None"];

private static var _levels:Array = [_level1, _level2, _level3, false, false, false, false, false, false, false];

Expand Down Expand Up @@ -51,7 +51,7 @@ package {
if (_levels[i] && SaveGame.levelUnlocked(i)) {
levelButton = new AxButton(xPos, yPos, _levelPics[i+1],90,90);//"", switchToState(_levels[i][0], _levels[i][2], _levels[i][3], _levels[i][4]));
//levelButton.soundDown = _clickSound;
levelButton.onClick(function ():void { Ax.sound(ClickSound); Ax.pushState(new Level2)})
levelButton.onClick(switchToState(_levels[i][0],null,null,null));
add(levelButton);
} else {
levelSprite = new AxSprite(xPos, yPos);
Expand All @@ -69,7 +69,7 @@ package {
private function switchToState(state:Class, title:String, objective:String, timeLimit:String):Function {
return function ():void {
//var levelDescr:LevelDescription = new LevelDescription(state, title, objective, timeLimit);
////FlxG.switchState(levelDescr);
Ax.switchState(new state);
}
}

Expand Down
Binary file added assets/images/level3bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b5d62a8

Please sign in to comment.