Created
May 13, 2015 21:28
-
-
Save ruby0x1/34536d5e6dab31e1286e to your computer and use it in GitHub Desktop.
Flag / Team component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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