Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package  
  2. {
  3.     import char.Enemy;
  4.     import char.Hero;
  5.     import flash.display.MovieClip;
  6.     import flash.events.Event;
  7.     import flash.events.MouseEvent;
  8.     import screens.MainMenu;
  9.     import screens.Credits;
  10.     import screens.Tutorial;
  11.     /**
  12.      * ...
  13.      * @author GuiGui
  14.      */
  15.     public class Main extends MovieClip
  16.     {
  17.         public var hero:Hero
  18.         public var enemy:Enemy
  19.         public var pad:Joystick
  20.         public var menu:MainMenu
  21.         public var bot:Button
  22.         public var tutorial:Tutorial
  23.         public var credits:Credits
  24.        
  25.         public function Main()
  26.         {
  27.             bot = new Button()
  28.             credits = new Credits()
  29.             tutorial = new Tutorial()
  30.             menu = new MainMenu()
  31.             addChild(menu)
  32.                 x = 400
  33.                 y = 300
  34.             var hero = new Hero()
  35.             addEventListener(Event.ENTER_FRAME,loop)
  36.         }
  37.        
  38.         public function loop(e:Event):void
  39.         {
  40.             addEventListener(MouseEvent.CLICK, mudaTela)
  41.         }
  42.        
  43.         public function mudaTela():void
  44.         {
  45.             if (bot.botAtual == "botCredits") {
  46.                 addChild(credits)
  47.                     x = 400
  48.                     y = 300
  49.             }
  50.             if (bot.botAtual == "botTuto") {
  51.                 addChild(tutorial)
  52.                     x = 400
  53.                     y = 300
  54.                 if (bot.botAtual == "botMenu") {
  55.                     removeChild(tutorial)
  56.                 }
  57.             }
  58.         }
  59.         public function control():void
  60.         {  
  61.             if (pad.DOWN)   hero.speedY += 5
  62.             if (pad.LEFT)   hero.speedX -= 5
  63.             if (pad.RIGHT)  hero.speedX += 5
  64.             if (pad.UP)     hero.speedY -= 55
  65.         }
  66.        
  67.     }
  68.  
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement