This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
es:orx:tutorials:scrolling [2012/03/05 06:42 (13 years ago)] – [Detalles] zera | es:orx:tutorials:scrolling [2020/08/19 21:14 (5 years ago)] (current) – Old content sausage | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Tutorial de Desplazamiento ====== | ||
- | |||
- | |||
- | |||
- | ===== Sumario ===== | ||
- | |||
- | Ver los anteriores [[main# | ||
- | |||
- | Este tutorial muestra como dibujar un [[http:// | ||
- | |||
- | Como puedes ver, no hay un código especial para el paralaje por movimiento en sí.\\ | ||
- | Actualmente, | ||
- | |||
- | Por defecto en este tutorial, el atributo '' | ||
- | Esto significa que un paralaje por movimiento sucederá en ambos ejes X y Y cuando se muevan las cámaras.\\ | ||
- | Tú puedes probar a poner este valor a la X, Y o cuando lo remuevas. | ||
- | |||
- | Más allá del atributo '' | ||
- | Este atributo es usado para automáticamente ajustar la escala de los objetos dependiendo en cuan lejos están de la cámara.\\ | ||
- | La cámara truncada más pequeña es, a la que más rápido se le aplicará esta autoescala.\\ | ||
- | Puedes probar y jugar con el posicionamiento de un objeto y los planos lejos & cerca de una cámara para lograr el desplazamiento deseado y frecuencias de escalado profundo que quieras. | ||
- | |||
- | Puedes cambiar la velocidad de desplazamiento (ej. la cámara se mueve rápido) en el fichero de configuración. Como es usual, puedes modificar su valor en tiempo real y hacer una recarga de la configuración histórica. | ||
- | |||
- | Como has podido ver, nuestra simple actualización de código mueve la cámara en el espacio 3D.\\ | ||
- | Presionando las flechas se moverá a traves de los ejes X y Y, y presionando las teclas control & alt a través de la Z.\\ | ||
- | Como dije anteriormente, | ||
- | Tu código meramente necesita mover tu cámara en tu escenario, sin tener ninguna molestia con los efectos de desplazamiento.\\ | ||
- | Esto te da un control total sobre tantos planos en desplazamiento quieras, y que objetos serán afectados por el.\\ | ||
- | |||
- | El último punto concierne al cielo.\\ | ||
- | Como vimos en el [[frame|tutorial de fotogramas]], | ||
- | Esto significa que la posición puesta por el objeto cielo en el fichero de configuración siempre será relativo a la cámara.\\ | ||
- | En otras palabras, el cielo siempre seguirá la cámara.\\ | ||
- | Como pusimos ahí, por defecto, a la profundidad de 1000 (ej. el mismo valor de un plano truncado de cámara alejada), el se mantendrá en el fondo(background). | ||
- | ===== Detalles ===== | ||
- | |||
- | As usual, we begin by loading our config file, getting the main clock and registering our '' | ||
- | Lastly, we create our '' | ||
- | Please refer to the [[main# | ||
- | |||
- | Now let's see our '' | ||
- | |||
- | <code c> | ||
- | |||
- | orxConfig_PushSection(" | ||
- | |||
- | orxConfig_GetVector(" | ||
- | orxVector_Mulf(& | ||
- | |||
- | orxConfig_PopSection(); | ||
- | </ | ||
- | |||
- | Nothing really new so far.\\ | ||
- | We now need to update our camera move vector depending on the active inputs. | ||
- | |||
- | <code c> | ||
- | { | ||
- | vMove.fX += vScrollSpeed.fX; | ||
- | } | ||
- | if(orxInput_IsActive(" | ||
- | { | ||
- | vMove.fX -= vScrollSpeed.fX; | ||
- | } | ||
- | if(orxInput_IsActive(" | ||
- | { | ||
- | vMove.fY += vScrollSpeed.fY; | ||
- | } | ||
- | if(orxInput_IsActive(" | ||
- | { | ||
- | vMove.fY -= vScrollSpeed.fY; | ||
- | } | ||
- | if(orxInput_IsActive(" | ||
- | { | ||
- | vMove.fZ += vScrollSpeed.fZ; | ||
- | } | ||
- | if(orxInput_IsActive(" | ||
- | { | ||
- | vMove.fZ -= vScrollSpeed.fZ; | ||
- | }</ | ||
- | |||
- | Lastly we apply this movement to our camera. | ||
- | |||
- | <code c> | ||
- | |||
- | As stated before, there' | ||
- | Everything will be done on the config side. We simply move our camera in our '' | ||
- | |||
- | Let's have a look at the config data. First our '' | ||
- | |||
- | <code ini> | ||
- | CloudNumber = 1000 | ||
- | ScrollSpeed = (300.0, 300.0, 400.0)</ | ||
- | |||
- | As you can see, we have our '' | ||
- | The '' | ||
- | |||
- | Let's now see our cloud object. | ||
- | |||
- | <code ini> | ||
- | Texture = ../ | ||
- | Pivot = center | ||
- | |||
- | [Cloud] | ||
- | Graphic | ||
- | Position | ||
- | AutoScroll | ||
- | DepthScale | ||
- | Color = (180, 180, 180) ~ (220, 220, 220) | ||
- | Alpha = 0.0 | ||
- | Scale = 1.0 ~ 1.5 | ||
- | FXList | ||
- | |||
- | The two important attributes here are '' | ||
- | |||
- | First, the '' | ||
- | This tells on which axis the [[wp> | ||
- | The [[wp> | ||
- | The closest the object is to the camera on the Z axis, the faster it will scroll. '' | ||
- | |||
- | The '' | ||
- | The closest the object is to the camera on the Z axis, the largest it will be displayed. '' | ||
- | |||
- | Let's now have a look at our sky object. | ||
- | |||
- | <code ini> | ||
- | Texture = ../ | ||
- | Pivot = center | ||
- | |||
- | [Sky] | ||
- | Graphic | ||
- | Scale = (0.5, 0.004167, 1.0) | ||
- | Position | ||
- | ParentCamera | ||
- | |||
- | As you can see, we set a '' | ||
- | We set it's position to '' | ||
- | When having a '' | ||
- | Hence our ' | ||
- | As our '' | ||
- | In the same way, as it is 240 pixel long on Y axis, we need a scale on Y of 1/240 = 0.004167. =) | ||
- | |||
- | ===== Recursos ===== | ||
- | |||
- | Código fuente: [[https:// | ||
- | |||
- | Fichero de configuración: | ||