From e986f8eff2a72d2370a3df3bac651c1746dcc6dc Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Thu, 2 Jul 2020 03:32:44 +0530 Subject: * Player Identification - Adds Red outline for enemies * Player HUD Name --- source/Player.hx | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'source/Player.hx') 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 { - 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); } } -- cgit v1.2.3