Created
May 22, 2013 12:34
-
-
Save sergey-miryanov/5627220 to your computer and use it in GitHub Desktop.
Example of movable group
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 ; | |
import org.flixel.FlxG; | |
import org.flixel.FlxSprite; | |
import org.flixel.FlxGroup; | |
import org.flixel.FlxTypedGroup; | |
import Analytics; | |
class FinalWindow extends FlxGroup implements IGameDialog | |
{ | |
private var _enabled : Bool; | |
public var immovable : Bool; | |
var _items : FlxTypedGroup<FlxSprite>; | |
var _window : FlxSprite; | |
var _close : FlxSprite; | |
var _rewind : FlxSprite; | |
var _toMainMenu : FlxSprite; | |
public function new() | |
{ | |
super(); | |
_enabled = false; | |
_items = new FlxTypedGroup(); | |
_items.add(_window); | |
_items.add(_close); | |
_items.add(_toMainMenu); | |
_items.add(_rewind); | |
var _background = AssetsManager.getEmptyBackground(0x77000000); | |
add(_background); | |
add(_items); | |
} | |
public function move(x : Float, y : Float) : Void | |
{ | |
var dx = _window.x - x; | |
var dy = _window.y - y; | |
for(item in _items.members) | |
{ | |
item.x -= dx; | |
item.y -= dy; | |
} | |
} | |
public function enable() : Void | |
{ | |
_enabled = true; | |
} | |
public function disable() : Void | |
{ | |
_enabled = false; | |
} | |
public function onShow(_callback : Void->Void) : Void | |
{ | |
_enabled = true; | |
} | |
public function onHide() : Void | |
{ | |
} | |
function onMouseClick() : Void | |
{ | |
} | |
public function handleMouse() : Void | |
{ | |
} | |
public function handleKeys() : Void | |
{ | |
} | |
override public function update() : Void | |
{ | |
handleMouse(); | |
handleKeys(); | |
super.update(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment