Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import char.Enemy;
- import char.Hero;
- import flash.display.MovieClip;
- import flash.events.Event;
- import flash.events.MouseEvent;
- import screens.MainMenu;
- import screens.Credits;
- import screens.Tutorial;
- /**
- * ...
- * @author GuiGui
- */
- public class Main extends MovieClip
- {
- public var hero:Hero
- public var enemy:Enemy
- public var pad:Joystick
- public var menu:MainMenu
- public var bot:Button
- public var tutorial:Tutorial
- public var credits:Credits
- public function Main()
- {
- bot = new Button()
- credits = new Credits()
- tutorial = new Tutorial()
- menu = new MainMenu()
- addChild(menu)
- x = 400
- y = 300
- var hero = new Hero()
- addEventListener(Event.ENTER_FRAME,loop)
- }
- public function loop(e:Event):void
- {
- addEventListener(MouseEvent.CLICK, mudaTela)
- }
- public function mudaTela():void
- {
- if (bot.botAtual == "botCredits") {
- addChild(credits)
- x = 400
- y = 300
- }
- if (bot.botAtual == "botTuto") {
- addChild(tutorial)
- x = 400
- y = 300
- if (bot.botAtual == "botMenu") {
- removeChild(tutorial)
- }
- }
- }
- public function control():void
- {
- if (pad.DOWN) hero.speedY += 5
- if (pad.LEFT) hero.speedX -= 5
- if (pad.RIGHT) hero.speedX += 5
- if (pad.UP) hero.speedY -= 55
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement