Skip to content

Instantly share code, notes, and snippets.

@ruby0x1
Created May 13, 2015 21:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruby0x1/34536d5e6dab31e1286e to your computer and use it in GitHub Desktop.
Save ruby0x1/34536d5e6dab31e1286e to your computer and use it in GitHub Desktop.
Flag / Team component
package game;
import luxe.Vector;
import luxe.Sprite;
import luxe.Color;
import luxe.Component;
import phoenix.Texture;
class PlayerTeam extends Component {
//offset rotation in degrees
public var flag : Sprite;
var teamcolor : Color;
override function init() {
if(teamcolor == null) {
teamcolor = new Color();
}
flag = new Sprite({
name : 'flag',
texture : Luxe.loadTexture('assets/game/flag.png'),
color : teamcolor,
size : new Vector(96,96),
pos : new Vector(32,32),
depth : 5
});
flag.texture.filter = FilterType.nearest;
flag.parent = entity;
entity.events.listen('player.flip', onflip);
}
public function set_team_color( _team_color:Color ) {
teamcolor = _team_color;
}
function onflip(_event:Dynamic) {
flag.flipx = _event.flipx;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment