Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package screens;
- import openfl.display.Sprite;
- import openfl.display.Stage;
- import openfl.Lib;
- import openfl.events.Event;
- /**
- * ...
- * @author ...
- */
- class Screen extends Sprite
- {
- var currentStage : Stage;
- private function new()
- {
- super();
- }
- public function OnLoad(){
- //currentStage = Lib.current.stage;
- }
- public function OnDestroy(){
- }
- }
- package screens;
- import openfl.Assets;
- import openfl.Lib;
- import openfl.display.Sprite;
- import openfl.display.Bitmap;
- /**
- * ...
- * @author Gin
- */
- class MenuScreen extends Screen
- {
- public function new()
- {
- super();
- trace("Menu Loaded");
- }
- public override function OnLoad(){
- ////Background
- currentStage = Lib.current.stage;
- var backgroundImage = new Bitmap(Assets.getBitmapData("assets/img/CG1.png"));
- backgroundImage.height = currentStage.stageHeight;
- backgroundImage.width = currentStage.stageWidth;
- addChild(backgroundImage);
- var toGame:Button = new Button(
- Assets.getBitmapData("assets/img/Button.png"),
- Assets.getBitmapData("assets/img/Button_over.png"),
- Assets.getBitmapData("assets/img/Button_pressed.png"),
- "Play",
- onPlayClick );
- toGame.x = (currentStage.stageWidth-toGame.width) / 2;
- toGame.y = currentStage.stageHeight / 3;
- addChild( toGame );
- }
- private function onPlayClick()
- {
- LevelManager.get_instance().NextLevel();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement