flare3d eva2011

18

Upload: christian-cabrera

Post on 20-Jul-2015

723 views

Category:

Education


1 download

TRANSCRIPT

Cómo hacer aplicaciones y videojuegos 3D para Flash Player 11

con Flare3D

Adrian Simonovich

Ariel Nehmad

José Luis Ressia

Configurando nuestra IDE para trabajar con Stage3D y Flash Player 11

• Flash Player 11• Flash Player 11 playerglobal.swc• Adobe Flex SDK 4.5.1• Flare3D (descargar desde www.flare3d.com)• IDE de su preferencia.

Cargando modelos 3D en Flash

• Scene3Dvar scene:Scene3D = new Scene3D(container);

• Pivot3Dvar astronaut:Pivot3D = scene.addChildFromFile( "astronaut.f3d“)

• Eventosscene.addEventListener( Scene3D.PROGRESS_EVENT, progressEvent );scene.addEventListener( Scene3D.COMPLETE_EVENT, completeEvent );

Definir el comportamiento de los objetos en la escena

• Las cosas por su nombre - getChildByName(“Objeto”)sky = planet.getChildByName( "sky" );

• planet.forEach( setupScene );private function setupScene( pivot:Pivot3D ):void{

if ( pivot.name == "fan" ){….}}

• private function updateEvent(e:Event):void { // Update the world.}

Posicionando la cámara

• Como posicionar un objeto en un entorno 3D

Pivot3DUtils.setPositionWithReference( scene.camera, 0, 80, -20, container, 0.1 );

• Pivot3DUtils.lookAtWithReference( scene.camera, 0, 0, 0, container,

container.getDir(), 0.05 );

Controlando al astronauta

• Detección de teclas• Input3D.keyDown()• Input3D.keyHit()

• RayosUn rayo es una linea virtual infinita que comienza en un puntoarbitrario y continua infinitamente en una dirección

• ray = new RayCollision();• ray.addCollisionWith( planet.getChildByName( "floor" ), false );

Controlando al astronauta

• Test del rayoif ( ray.test( from, dir ) ){

// Get the info of the first collision.var info:CollisionInfo = ray.data[0];

// Set the astronaut container at the collision point.container.setPosition( info.point.x, info.point.y, info.point.z );

// Align the astronaut container to the collision normal.container.setNormalOrientation( info.normal, 0.05 );

Detectando colisiones con obstaculos

• SphereCollisionprivate var collisions:SphereCollision;

Creando la colisioncollisions = new SphereCollision( container, 3, new Vector3D( 0, 3, 0 ) );

• Agregando la colision con objetoscollisions.addCollisionWith( pivot, false );

• Detectando la colisioncollisions.slider();

Partículas – Simulando fuego y humo

Controlando los movimientos del personaje

• Control de estados- run- jump

• Método GameLogicsswitch( state )

{case "run":

if ( Input3D.keyHit( Input3D.SPACE ) ) { jumpValue = 4;

fireEmiter.emitParticlesPerFrame = 25;container.gotoAndPlay( "jump", 3 );

}break;

}

Agregando peligros al juego

• Flash Player 11• Flash Player 11 playerglobal.swc• Adobe Flex SDK 4.5.1• Flare3D (descargar desde www.flare3d.com)• IDE de su preferencia.

Agregando peligros al juego

Agregando sonidos y la interfaz 2D

FLASH!

www.flare3d.com

wiki.flare3d.com

¿preguntas?

GAME OVER

¡GRACIAS!