el problema es para hacerle una introduccion precarga, menú de opciones etc,
la verdad no tengo idea de como realmente se arma un juego hacerlo sin la introducción sera mas sencillo pero no tendría mucho sentido ahora intente poner una variable "game_play"en la clase main si es true carga las opciones false no hace nada.
La variable esta declarado como false y en el fotorama que inicia el juego la pondría como true pero no da resultado.
Lo que pido es el consejo de alguin que ya halla desarrollado juego solo una guia de como tendría que armarlo. desde ya gracias
Dejo un poco de código para que entiendan mejor :
La clase Main
Código ActionScript :
package com{ import flash.display.*; import flash.events.*; import flash.geom.*; import flash.filters.*; import flash.text.TextField public class Main extends MovieClip{ var pizza public static var scoreRef:Number=0 public static var game_play:Boolean=false public var $score:Score=new Score(); public function Main():void { var key:KeyFlag= new KeyFlag(char,stage) char._piso=limit char._ref=stage char._items=helt addEventListener(Event.ENTER_FRAME,scoretxt,false,0,true) score_txt.text="" stage.scaleMode=StageScaleMode.SHOW_ALL pizza=new Pizza(); addChild(pizza) porcion00.tar=char porcion00.Bandeja=ttr pizzeta.tar=char Score._scoreRef=score_txt } private function scoretxt(even:Event):void { score_txt.text=String(scoreRef) } }// //END CLASS AND PACK }//
esta se encarga de pasarle las referencias al resto de las clases.
La clase del Char
Código ActionScript :
package com{ import flash.display.MovieClip import flash.display.Stage import flash.events.Event public class Char extends MovieClip{ private var friccion:Number=0.95 private var yspeed:Number=0 private var grav:Number =1 private var salto:Number= 6.5 private var tsalto=0 private var walk_jump:Boolean=true private var can_jump:Boolean=true public var ptBajo:Number=height/2 public var ptAlto:Number=-height/2 public var ptIzq:Number=-width/2 public var ptDer:Number=width/2 public var _piso:MovieClip; public var _ref:Stage; public var dx:Number=0 public var newBlood private var vel:Number = 2 private var maxvel:Number = 8 public static var msj:MovieClip=null public var _items:MovieClip; public function Char():void { //_items._helt= null addEventListener(Event.ENTER_FRAME,gravedad,false,0,true) } private function gravedad(evento:Event):void { coliciones() //if (_piso) if( _piso.hitTestPoint (x,y+ptBajo+1,true)) { y-=0,yspeed=0,can_jump=true } else { yspeed += grav; y += yspeed; } } private function coliciones():void { movesOn() while (_piso.hitTestPoint(x,y+ptBajo,true)) y -- while( _piso.hitTestPoint(x,y+ptAlto,true))y ++ //Colicion en lado Izq while (_piso.hitTestPoint(x+ptIzq,y,true)) x ++ while (_piso.hitTestPoint(x+ptIzq,y+ptBajo/3,true)) x ++ //Colicion en lado Derecho while (_piso.hitTestPoint(x+ptDer,y,true)) x -- while (_piso.hitTestPoint(x+ptDer,y+ptBajo/3,true)) x -- //////OTROS HITTESTING///// if (_piso.puas.hitTestPoint(x,y+ptBajo+2,true)) msj= new Globo_msj(),stage.addChild(msj),Energia.energiDecres-=10; if (_items.hitTestPoint(x,y+ptDer,true)|| _items.hitTestPoint(x,y+ptIzq,true) ){ parent.removeChild(_items)} } public function movesOn():void { if(msj)msj.x=x+50,msj.y=y+ptAlto+15; this.x+=dx; dx*=friccion; if (dx > maxvel)dx=maxvel else if (dx<-maxvel )dx=-maxvel } private function moverblood(eve:Event):void {/* newBlood.x=this.x */ } }// //END PACK AND CLASS }//
y ahi un monton de clases para el manejo del pj "KeyFlags.as" y cada item en si tiene su clase.
Espero un empujon saluda Maxx