Skip to content
Browse files

Added some of the player animations, did a bit of cleaning up.

  • Loading branch information...
1 parent d0c3e22 commit cfd9bb3fffc25e0f3e7c59d7b4b27968c0dba317 @raptros committed Jul 6, 2010
View
BIN build/assets/animation-player.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/animation.psd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
3 src/BarThing.as
@@ -8,7 +8,6 @@ package
*/
public class BarThing extends FlxSprite
{
- public static var COLOR:uint = 0x999999;
public var startPos:FlxPoint;
public static var SIZE:Number = 10;
@@ -24,8 +23,6 @@ package
public function BarThing(initX:Number, initY:Number, leftBound:Number, rightBound:Number)
{
super(initX, initY);
- createGraphic(SIZE, SIZE);
- color = COLOR;
leftB = leftBound;
rightB = rightBound;
View
2 src/GameOverState.as
@@ -13,7 +13,7 @@ package
{
FlxG.mouse.show();
- over = new FlxText(0, 120, 400, "Game Over. Your score: " + FlxG.score + " .");
+ over = new FlxText(0, 120, 400, "Game Over. Your score: " + FlxG.score + ".");
over.setFormat(null, 10, 0xffffff, "center", 0);
add(over);
}
View
3 src/Patron.as
@@ -9,8 +9,6 @@ package
*/
public class Patron extends BarThing
{
- public static var COLOR1:uint = 0x00ff00;
- public static var COLOR2:uint = 0x00ffff;
public static var SIZE:Number = 40;
[Embed(source="../build/assets/patron_placeholder.png")]
@@ -36,7 +34,6 @@ package
loadGraphic(PatronSprite, false, false, SIZE, 26);
- //color = COLOR1;
collideLeft = false;
collideRight = true;
View
35 src/PlayState.as
@@ -11,7 +11,7 @@ package
//speeds
private var playerStep:Number = 2;
private var mugSpeed:Number = 100;
-
+
//points for events
private var giveMugPoints:Number = 1;
private var collectMugPoints:Number = 2;
@@ -56,6 +56,7 @@ package
private var player:Player;
+
/**
* get all the settings for the level to be played.
*/
@@ -153,6 +154,7 @@ package
freezer -= FlxG.elapsed;
if (freezer <= 0)
frozen = false;
+ player.update();
return ;
}
@@ -174,8 +176,12 @@ package
var pos:FlxPoint;
//Handle input.
- if (FlxG.keys.justPressed("SPACE") && player.x == curBase.x && player.y == curBase.y)
+ if (FlxG.keys.justPressed("SPACE") && player.x == curBase.x && player.y == curBase.y)
{
+ }
+ if (FlxG.keys.justReleased("SPACE") && player.x == curBase.x && player.y == curBase.y)
+ {
+ player.play("throwing");
//chuck a mug from the current position. reuse available mug objects
//by checking with the mug group.
pos = mugPositions[barNum];
@@ -201,6 +207,7 @@ package
//move the player up or down a bar.
else if (FlxG.keys.justPressed("UP"))
{
+ player.facing = FlxSprite.RIGHT;
barNum--;
if (barNum < 0)
barNum = bars.length - 1;
@@ -209,6 +216,7 @@ package
}
else if (FlxG.keys.justPressed("DOWN"))
{
+ player.facing = FlxSprite.RIGHT;
barNum++;
if (barNum >= bars.length)
barNum = 0;
@@ -218,14 +226,29 @@ package
//move player left or right along bar
else if (FlxG.keys.LEFT && player.x > curBar.left)
{
+ player.facing = FlxSprite.RIGHT;
player.x -= playerStep;
}
- else if (FlxG.keys.RIGHT && player.x < curBar.right)
+ else if (FlxG.keys.RIGHT && player.x < curBase.x)
{
+ player.facing = FlxSprite.LEFT;
player.x += playerStep;
}
+ //animation checks that will be separate.
+ if (FlxG.keys.justPressed("LEFT") || FlxG.keys.justPressed("RIGHT"))
+ {
+ player.play("running");
+ }
+ else if (!FlxG.keys.LEFT && !FlxG.keys.RIGHT && (FlxG.keys.justReleased("LEFT") || FlxG.keys.justReleased("RIGHT")))
+ {
+ player.facing = FlxSprite.RIGHT;
+ player.frame = 0;
+ }
+
+
+
//check overlap of player and empty mugs
FlxU.overlap(player, curMugs, playerMugged);
@@ -382,7 +405,8 @@ package
{
lives--;
frozen = true;
- freezer = 1.0;
+ freezer = 2.0;
+ player.play("dropped");
}
/**
@@ -396,7 +420,8 @@ package
{
lives--;
frozen = true;
- freezer = 1.0;
+ freezer = 2.0;
+ player.play("dropped");
}
}
View
10 src/Player.as
@@ -4,15 +4,19 @@ package
public class Player extends FlxSprite
{
- [Embed(source="../build/assets/bartender_placeholder.png")]
+ [Embed(source="../build/assets/animation-player.png")]
private var BartenderSprite:Class;
public function Player(pos:FlxPoint)
{
super(pos.x, pos.y);
- //TODO this needs to be cleaned up by the correct graphics
- loadGraphic(BartenderSprite, false, false, 32, 51);
+ //TODO add more animations.
+ loadGraphic(BartenderSprite, true, true, 60, 52);
+ addAnimation("standing", [0], 10, false);
+ addAnimation("throwing", [1, 0], 2, false);
+ addAnimation("dropped", [2, 2, 0], 1, false);
+ addAnimation("running", [3, 4, 5, 6], 8, true);
//createGraphic(10,20);
//color = 0x0000ff;
View
2 src/StartGameState.as
@@ -22,7 +22,7 @@ package
add(new FlxSprite(0,0,TitleSprite));
var mug:FlxSprite = new FlxSprite(430,151);
- mug.loadGraphic(BeerMugSprite,true, false, 118,166);
+ mug.loadGraphic(BeerMugSprite,true, true, 118,166);
mug.addAnimation("fill", [0,1,2,3,4,5,6,7,8,9,10], 5, false);
add(mug);

0 comments on commit cfd9bb3

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