aboutsummaryrefslogtreecommitdiff
path: root/source/Player.hx
blob: 2aba60c118c85cc5d89ab64fbea14384a143f15f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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 FlxTypedSpriteGroup<FlxSprite>
{
	var _effectSprite:FlxEffectSprite;
	var _outline:FlxOutlineEffect;

	public function new(x:Float = 0, y:Float = 0, name:String, sessionId:String)
	{
		super(x, y);
		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);
	}
}