Wednesday 2 June 2010

Transisitions

Originally my idea for the transition of the game was to have a sliding action from scene to scene. I wanted the user to feel like they were part of a real kitchen and to make it as realistic as possible.

When I sketched out the flowchart for the game I planned the position of certain objects so that in the event of the transition, objects could slide across the screen and be placed in the correct position with ease.

I researched into tween classes to help my achieve the sliding action.

First I had to import the classes:

import mx.transitions.Tween;
import mx.transitions.easing.*;

Then I had to tell the actionscript where to slide from and when to slide:

holder2.onPress = function() {

Within this function, I added some code, within the paraentheses I can tell the actionscript:

1. What object to slide, in this case it was _root.holder (I gave the object the instance name of "holder")

2. What co-ordinates to slide (this can be _x/_y/_width/_height)

3. Gave the slide a style.

4. Where to start the slide from

5. Where to finish the slide at

6. The duration of the tween

7. Indicates whether the duration is measured in seconds or frames (a boolean of true for seconds and false for frames is used)

var myHoriTween:Tween = new Tween(_root.holder, "_x", Strong.easeIn, _root.holder._width, _root.holder._width-10000, 1, true);

var myHoriTween:Tween = new Tween(_root.holder, "_y, Strong.easeIn, _root.holder._height, _root.holder._height-10000, 1, true);

However after my research and producing a dummy test I decided to change the transition effect to a simple fade in/fade out.

To enable the slide action I would have had to put the objects needed to slide within a movieclip. This was okay, however the pop up instructions which I delegated this slide action code to was on a seperate movieclip above the game.

This caused a few problems and due to time constraints I decided to make each scene fade in and out using a simple motion tween and alpha transparency. In the future I would like to add this slide action to the game as I think it would enhance the users experience.

No comments:

Post a Comment