Skip to content

Commit

Permalink
Added ability to notice if the player collected the soul gem
Browse files Browse the repository at this point in the history
where the soul gem is the pickup
  • Loading branch information
DavidFarrell committed Jan 29, 2012
1 parent 89f4dfd commit 59185a3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 28 deletions.
14 changes: 5 additions & 9 deletions maps/MapDavidMap.as
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//Code generated by Flan. http://www.tbam.com.ar/utility--flan.php

package {
import com.adamatomic.flixel.*;

Expand Down Expand Up @@ -31,25 +33,19 @@ package {
override public function addSpritesToLayerMainGame(onAddCallback:Function = null):void {
var obj:FlxSprite;

obj = new Player(98, 255);;
obj.x+=obj.offset.x;
obj.y+=obj.offset.y;
FlxG.state.add(obj);
if(onAddCallback != null)
onAddCallback(obj);
obj = new Tree(987, 317);;
obj = new Exit(296, 223);;
obj.x+=obj.offset.x;
obj.y+=obj.offset.y;
FlxG.state.add(obj);
if(onAddCallback != null)
onAddCallback(obj);
obj = new Exit(1262, 96);;
obj = new Player(30, 241);;
obj.x+=obj.offset.x;
obj.y+=obj.offset.y;
FlxG.state.add(obj);
if(onAddCallback != null)
onAddCallback(obj);
obj = new Exit(1254, 198);;
obj = new Pickup(242, 126);;
obj.x+=obj.offset.x;
obj.y+=obj.offset.y;
FlxG.state.add(obj);
Expand Down
22 changes: 14 additions & 8 deletions src/MapDavidMap.as
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ package {
layerMainGame.y = 0;
layerMainGame.scrollFactor.x = 1.000000;
layerMainGame.scrollFactor.y = 1.000000;

allLayers = [ layerMainGame ];


boundsMinX = 0;
boundsMinY = 0;
boundsMaxX = 1280;
boundsMaxY = 704;
}

override public function addSpritesToLayerMainGame(onAddCallback:Function = null):void {
var obj:FlxSprite;

Expand All @@ -46,14 +46,20 @@ package {
FlxG.state.add(obj);
if(onAddCallback != null)
onAddCallback(obj);
obj = new Pickup(242, 126);;
obj.x+=obj.offset.x;
obj.y+=obj.offset.y;
FlxG.state.add(obj);
if(onAddCallback != null)
onAddCallback(obj);
}

override public function customFunction(param:* = null):* {

}

private function _setCustomValues():void {
}

}
}
2 changes: 2 additions & 0 deletions src/PlayState.as
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,8 @@ package
public function HandlePickUps(p:Player, pUp:Pickup):void
{
pUp.kill();

statsTracker.increment("pickups");
//TODO: Handle pickup logic, give some kind of metric
}

Expand Down
32 changes: 21 additions & 11 deletions src/SummaryState.as
Original file line number Diff line number Diff line change
Expand Up @@ -26,41 +26,51 @@ package
t.size = 32;
t.alignment = "center";
add(t);
t = new FlxText(FlxG.width/2-100,200,200,"You completed the level using: ");
t = new FlxText(400,200,400,"You completed the level using: ");
t.size = 16;
t.alignment = "center";
t.alignment = "left";
t.color=0xFF000000;
add(t);


t = new FlxText(FlxG.width/2-100,350,200, statsTracker.getValue("explosions") + " explosions");
t = new FlxText(450,250,200, statsTracker.getValue("explosions") + " explosions");
t.size = 16;
t.alignment = "center";
t.alignment = "left";
t.color=0xFF000000;
add(t);

t = new FlxText(FlxG.width/2-100,400,200, statsTracker.getValue("trees") + " trees");
t = new FlxText(450,290,200, statsTracker.getValue("trees") + " trees");
t.size = 16;
t.alignment = "center";
t.alignment = "left";
t.color=0xFF000000;
add(t);

t = new FlxText(FlxG.width/2-100,450,200, statsTracker.getValue("platforms") + " platforms");
t = new FlxText(450,320,200, statsTracker.getValue("platforms") + " platforms");
t.size = 16;
t.alignment = "center";
t.alignment = "left";
t.color=0xFF000000;
add(t);

t = new FlxText(FlxG.width/2-100,500,200, statsTracker.getValue("spawn_points") + " spawn points");
t = new FlxText(450,360,200, statsTracker.getValue("spawn_points") + " spawn points");
t.size = 16;
t.alignment = "center";
t.alignment = "left";
t.color=0xFF000000;
add(t);

var successString : String = "You failed to retrieve the soul gem";
if ( statsTracker.getValue("pickups") > 0) {
successString = "You retrieved the soul gem";
}
t = new FlxText(400,520,800, successString);
t.size = 32;
t.alignment = "left";
t.color=0xFF000000;
add(t);


t = new FlxText(FlxG.width/2-100,600,200,"Press any Key");
t.size = 16;
t.alignment = "center";
t.alignment = "left";
t.color=0xFF000000;
add(t);

Expand Down

0 comments on commit 59185a3

Please sign in to comment.