Tuesday 4 October 2011

Engine Update


http://flippinmental.deviantart.com/art/Wasabi-engine-with-stuff-261732236
Alright so its engine update time again and for the first time we actually have assets and dialog from the script in it! It might be worth downloading it onto your computer rather then playing it in browser due to the large file size which is a result of something I will get to later.  Please note that certain things like the character sprites I used the ones on the website and just edited them myself as I wanted to test it out. These along with anything else visual can always be changed and replaced at a later date but for now I'm more concerned with getting everything in and making sure it's working. Remember assets are super easy to swap out once they are actually in the engine. Cut scene isn't present this time as I'm still working on it and got a few more changes to make. Which reminds me I don't have the eerie sound effect, could you drop box that to me Jade?  Also the conversation between the guard and Yu seems a bit weird as a little tutorial will be placed there at a later stage. Oh and as one super awesome special surprise I've added the start of the drawing puzzle code (you get to it by pressing the arrow on carriage 4, and exit it by pressing the white square in the top left hand corner). I'm really pleased with this as it's actually nothing like what I intended to do. See I was going to create it by abusing the update function of flixel and just have it that on every update a sprite (that would be a little black circle) would be added at the x and y position of the mouse. That's fine and all but when you start moving fast it can't quite keep up. Anyway I decided to browse the Internet to see if anyone else had tried anything like that and I found something even better. I found a class library all for drawing. So I was able to inset a really smooth drawing tool into the engine in minutes. It's great! However this is the reason the file size is much larger then before. A quick search on some forums reveals that this is much the case with any drawing tools in flash. Have a play around with it. Things I'm going to do tomorrow and Thursday is add all the items into the game, finish off the cut scene and add a tutorial for using items as well as the first item that will do something :O How exciting! 

Oh yeh and there are weird quirks I'm aware of such as if you go to the item screen and exit it again you could end up in the wrong place. That's not a big I just haven't added the code for that yet.

Here's a list of things I've done today;

  • Added the characters, and animations
  • Corrected a bug that would prevent all other dialog from displaying if dialog is displayed as the first thing when you enter a room (which is the case for Yu's room and carriage 1)
  • Made it so that once certain messages have been displayed once they will never appear again
  • Begun work on the drawing puzzle's code
  • Tweaked some things in the cutscene like adding random typing sounds 
  • Added all the items and their dialog that you can look at in Yus room
  • Added all the carriages, however only the first one has anything you can click on
  • Added music to the opening cutscene and changed some of the timings for sounds to hopefully correct them
And something that I thought might be fun (very loose definition of the word fun) is to see how to code ends up looking for your typical room.
package
{
   
    import flash.ui.Mouse;
    import flash.utils.Endian;
    import org.flixel.*;
    import flash.utils.Timer;
    import org.flixel.system.FlxWindow;
   
    import flash.display.*;
    import flash.events.*;
   
    /**
     * ...
     * @author Michael
     */
    public class YusRoomTrain extends SceneState
    {
       
        [Embed (source = "../data/Backgrounds/yusroomday1a.png")] static public var yusroom:Class;
       
        private var bg:FlxSprite;
       
        private var laptop:Window;
       
        private var outwin:Window;
       
        private var bed:Window;
       
        private var luggage:Window;
       
        private var bathroomdoor:Window;
       
        private var wordsBath:Array;
       
        private var wordsLuggage:Array;
       
        private var wordsBed:Array;
       
        private var wordsLaptop:Array;
       
        private var wordsWindow:Array;
       
        private var wordsStart:Array;
       
        private var arrowright:Window;
       
       
       
       
       
        public var start_time:Number = 0;
       
        public function YusRoomTrain()
        {
               
        }
       
        override public function create():void
        {
           
           
            bg = new FlxSprite(0, 0,yusroom );
            add(bg);
           
           
            laptop = new Window(260, 480);
            laptop.makeGraphic(140, 50);
            laptop.clickFunction = clickLaptop;
            add(laptop);
           
            outwin = new Window(100, 170);
            outwin.makeGraphic(270, 320);
            outwin.clickFunction = clickWindow;
            add(outwin);
           
            bed = new Window(400, 600);
            bed.clickFunction = clickBed;
            bed.makeGraphic(600, 200);
            add(bed);
           
            luggage = new Window(500, 550);
            luggage.clickFunction = clickLuggage;
            luggage.makeGraphic(200, 100);
            add(luggage);
           
            bathroomdoor = new Window(900, 150);
            bathroomdoor.clickFunction = clickDoor;
            bathroomdoor.makeGraphic(100, 530);
            add(bathroomdoor);
           
                   
            arrowright = new Window(1100, 500);
            arrowright.loadGraphic(GlobalVars.arrowright);
            arrowright.alpha = 1;
            arrowright.clickFunction = clickArrow;
            add(arrowright);
           
           
           
           
            sceneNO = 4;
           
            wordsStart = new Array("Crap. I forgot to plug in the charger before I started typing. Sigh. Oh well, maybe I'll go explore the train for a bit and give my legs a stretch....maybe grab a drink too.");
           
            wordsLaptop = new Array("My laptop is charging at the moment. By the time I get back I should be able to save what I've written properly and watch a movie perhaps.")
           
            wordsWindow = new Array("The sun is starting to set … looks like we're passing by a few mountains.");
           
            wordsBed = new Array("It's worth forking out for a first class ticket. I don't want to deal with people at the moment ...");
           
            wordsLuggage = new Array("My bag. My novel is in there somewhere ... I might read it later.");
           
            wordsBath = new Array("I've no reason to go to the bathroom.");
           
           
           
           
           
           
            FlxG.stage.addEventListener(Event.ENTER_FRAME, op);
           
            super.create();
           
        }
       
        private function op(e:Event):void
        {
           
           
           
           
           
           
            if (yuroomfirsttime == 0 )
            {
            dialog.showDialog(wordsStart);
            yuroomfirsttime = 1;
            }
            FlxG.stage.removeEventListener(Event.ENTER_FRAME, op);
           
        }
       
       
       
       
       
        private function clickLaptop():void
        {
            dialog.showDialog(wordsLaptop);
        }
       
        private function clickWindow():void
        {
            dialog.showDialog(wordsWindow);
        }
       
        private function clickBed():void
        {
            dialog.showDialog(wordsBed);
        }
       
        private function clickLuggage():void
        {
            dialog.showDialog(wordsLuggage);
        }
       
        private function clickDoor():void
        {
            dialog.showDialog(wordsBath);
        }
       
        private function clickArrow():void
        {
            FlxG.fade(0x00000000, 1,afterfade);
        }
       
        private function afterfade():void
        {
            FlxG.switchState(new TrainCarriage01);
        }
    }
   
   
}

4 comments:

  1. Awesome win Mike!!!

    Am liking the drawing puzzle too!!! It's really awesome to see it being put together now!!

    Are you fine with me drop boxing the character sprites as a psd and you can edit them yourself Or do you want me to do drop box the final sizes? If you can do it it'll be great but if you feel overloaded, I'll do them lol.

    THANKS MAN!

    ps eerie gong sound should be dropboxed now

    ReplyDelete
  2. Cheers. Let me know of any notes like things I wasn't too sure about were the size and position of the character sprites. I didn't fuss over them too much today but I shall take a closer look at them later.

    You can drop box me the psd of the character sprites as I'll need to arrange them into a spirte sheet anyway which dosn't take too long, so yeh thats fine.

    ReplyDelete
  3. Refer to my earlier test screenies but definitely make them fit the screen instead of hovering above the dialogue box. It's fine for them to be behind them and I guess make the sizes fit the BG somehow but I'm not too fussed as long as they're consistant.

    Awesome, Yu's sprite should be done and I'll dropbox the guard one too.

    Thanks!

    ReplyDelete
  4. this looks amazing mike!!!! so proud ;w;

    ReplyDelete

Note: only a member of this blog may post a comment.