aboutsummaryrefslogtreecommitdiff
path: root/source/Player.hx
diff options
context:
space:
mode:
authorIndrajith K L2020-07-02 03:32:44 +0530
committerIndrajith K L2020-07-02 03:32:44 +0530
commite986f8eff2a72d2370a3df3bac651c1746dcc6dc (patch)
tree3587e0a6afb982c5dddb726fa11f389c7428abe7 /source/Player.hx
parent99ce676d028afb2daeed975a416098e5c49d8d55 (diff)
downloaddungeon-client-e986f8eff2a72d2370a3df3bac651c1746dcc6dc.tar.gz
dungeon-client-e986f8eff2a72d2370a3df3bac651c1746dcc6dc.tar.bz2
dungeon-client-e986f8eff2a72d2370a3df3bac651c1746dcc6dc.zip
* Player Identification - Adds Red outline for enemiesHEADmaster
* Player HUD Name
Diffstat (limited to 'source/Player.hx')
-rw-r--r--source/Player.hx23
1 files changed, 20 insertions, 3 deletions
diff --git a/source/Player.hx b/source/Player.hx
index 80c3f78..2aba60c 100644
--- a/source/Player.hx
+++ b/source/Player.hx
@@ -1,13 +1,30 @@
package;
import flixel.FlxSprite;
+import flixel.addons.effects.chainable.FlxEffectSprite;
+import flixel.addons.effects.chainable.FlxOutlineEffect;
+import flixel.group.FlxGroup.FlxTypedGroup;
+import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup;
+import flixel.text.FlxText;
import flixel.util.FlxColor;
-class Player extends FlxSprite
+class Player extends FlxTypedSpriteGroup<FlxSprite>
{
- public function new(x:Float = 0, y:Float = 0)
+ var _effectSprite:FlxEffectSprite;
+ var _outline:FlxOutlineEffect;
+
+ public function new(x:Float = 0, y:Float = 0, name:String, sessionId:String)
{
super(x, y);
- loadGraphic("assets/images/player.png");
+ var player = new FlxSprite();
+ player.loadGraphic("assets/images/player.png");
+ add(_effectSprite = new FlxEffectSprite(player));
+ if (sessionId != name)
+ {
+ _outline = new FlxOutlineEffect(FlxColor.RED, 2);
+ _effectSprite.effects = [_outline];
+ }
+ var text = new FlxText(0, 2, 0, name, 8);
+ add(text);
}
}