Lecture 06 - Replacing Tiles, Animated Tiles and Movie Style Title.

Written by Ferlin Scarborough.

Goal of the lecture

The goal of this lecture is to teach the student how to add animated tiles to a game, also to explain how to add a Movie Credit Style Title sequence.


Getting In Contact With The Teacher.

If you need to contact me, use either my email at gameprogramming.org or use the course forum. If you have any questions, the course forum is a good place to see if there is anyone who can help you, and you would probably get a faster answer than from me.


Resource Files For This Lecture.

There are a few resource files available for this lecture, so now would be a very good time to download those and install them, below is a list of the resource files and where they need to be installed (Unziped).

The path names listed below assumes that you installed the Toolkit into its default directory, if not you will have to modify these paths to suit your needs.

Open Up To Me.

Replacing Tiles.

Well, here it is just like I've been promising you.  At some point in your game you probably want to replace one tile on your board with another one, usually after something takes place in the game.  For example you have a treasure chest tile on the board and after the player gets the contents of the chest you would like to replace the tile of the closed chest with a tile representing an open chest.  How would you go about accomplishing this?

First of all in our DarknessFalls.tst tileset we have a tile of an open chest.

Here is a snapshot of the first 45 tiles in our DarknessFalls.tst tileset.



In the last lecture (lecture 5) we created a town called Chulak and in that town we created an Inn.  Near the bottom left of the Inn, there is a chest.  I placed the mouse over the chest and took a screen shot of it, so the below screen shot shows that the chest tile is located at 15,19 you can see this on the Board Editor near the top right, just under where it says Draw Lock.

The Chulak Inn in the town of Chulak.  This picture shows the chest we will be working with.



Since the closed chest is sitting on the wooden floor, then we will need an open chest that has a wooden floor behind it or is transparent.  It just so happens if you look at the picture above of the tileset we have a tile of an open chest with the wooden floor behind it.

If you are not already aware of it, each tile in a tileset is numbered starting with 1.   If you look at our DarknessFalls.tst tileset you will notice that the chest tile I am referring to is tile number 5.  Armed with this information you can refer to a specific tile in a tileset using the following syntax DarknessFalls.tst5, notice the 5 on the end of the tileset name, this tells the Toolkit that we are referring to the 5th tile in our tileset.  Now that we understand the tile numbering concept, let's start working on tile replacement on a board.

Replacing The Closed Chest With An Open Chest Tile.

The first thing we need to do is to create an Item of the open chest.  Create a new item that looks like the one below.





Save this new item with the file name of OpenChest.itm.

Next we need to create an RPGCode program to do the tile replacing for us.  Here is the one that I use called Chest1.prg, create the following program and save it using the name of Chest1.prg.

#If (Chest1Empty! = 0)
{
  #GiveItem("SmallSword.itm")
  #LayerPut(15,19,1,"DarknessFalls.tst5")
  #SaveScreen()
  #MWin("You Have Found A Small Steel Sword!")
  #Wait(a$)
  #RestoreScreen(0, 0, 800, 600, 0, 0)
  #Chest1Empty! = 1
  #HaveSword!=1
  #Done()
}
#MWinCls()
#LayerPut(15,19,1,"DarknessFalls.tst5")
#SaveScreen()
#MWin("The Chest Is Empty")
#Wait(a$)
#RestoreScreen(0, 0, 800, 600, 0, 0)
#Done()

Most of the commands in the above program you are already familiar with, the new ones used here that may need to be explained a little further would be the #LayerPut(), #SaveScreen(), #RestoreScreen() and the #Done() commands.

The HaveSword! variable we will be using later on, to tell if the player has gotten the sword yet or not.

Good, now we have a program to do the tile replacing for us, so let's put this new program to work for us.  Load up the Chulak.brd board into the Board Editor.   Next click on the RPGCode Menu then click on the Set Program choice, and click on the chest in the Inn, and choose the Chest1.prg program we just created.   Now save the board again, and if you like test run the program to see what happens.

If you test ran the program and walked into the Inn and up to the chest, you probably noticed that it did what we wanted.  Once we got the sword it replaced the closed chest on the board with an open chest.  But wait a minute, what happened when you left the city and came back?  The chest was closed again, what happened?   Did our little ghost George come along and close it then giggle at us about it?

What happens is the Toolkit forgets all about the changes we make to a board at run time once we leave that board, so when we return it reloads the original board.  So, anyone have any ideas how we can overcome this little problem with our chest?

I know there are probably many different ways to solve this little annoying problem.   The first time I did this in one of my games, it took me a while to figure out a way to "Trick" the Toolkit into doing what I wanted.  But, finally I came up with this little solution to solve it.

Create the little program listed below and save it as OpenChest.prg.

#LayerPut(15,19,1,"DarknessFalls.tst5")
#Done()

Be careful now, these long programs can be hard to follow. :)

Load up the Chulak.brd board again into the Board Editor, and click on the RPGCode Menu, then click on the Set Program choice, and click on the chest. This will pop up the following window.



First set the Filename field to OpenChest.prg the program you just created.   Then set the Display Program As field under the graphics section to the open chest tile in your tileset (tile 5).  Next choose Conditional Activation choice and in the field labeled Active If Variable type in the variable name of HaveSword!, then set the value for this variable to 1, then make the same changes to the field labeled After Activation,

What we did here was to set a program on the chest tile, that would not be active at first because the HaveSword! variable is equal to 0, looking back at our chest1.prg program you will notice that when the player opens the chest and the sword is given to them the variable HaveSword! is then changed to a value of 1.  Told you I would get back to this variable later on when we created the Chest1.prg program.   Once this program is activated and runs, we make sure the HaveSword! variable remains at a value of 1, that way the program will continue to be ran.  The end result is if we leave the board and come back, the OpenChest.prg program will see that the variable HaveSword! is equal to 1 and run again, setting the graphic for the chest tile to our open chest tile.  Every now and then you will come across things like this in the Toolkit that just seems to go against what you are trying to accomplish.  But, you can see that with the power of RPGCode you can overcome just about anything like this.

Now click on the Set Program button on this screen to set the program, then save your board again, and try the game once more, this time when you get the sword from the chest it should open up, and if you leave town and return it will still be open.  Great that is exactly the effect we were after.

I'm On The Move.

Animated Tiles.

Now it is time to discuss animated tiles.  You may be wondering just what you would use animated tiles for?  Well, you can use animated tile to add some motion to your boards, such as a torch where the flame is moving, or flowing water or any type of motion you would want on a board.

You can create animated tiles by clicking on the Edit Animated Tile button.   Which will pop up the Animated Tile Editor, like the one showing below.



The Animated Tile Editor works almost exactly like the Animation Editor, if you are not familiar with the Animation Editor, then you have not done the previous lectures and are not supposed to be this far yet anyway.  I have added the water tiles to the DarknessFalls.tst tileset, for each water tile there are two tiles, each one the water is a little different in.

To create our animated water tile, click on the white box in the Animated Tile Editor and then click on the DarknessFalls.tst tileset, and choose the first water block, like the one in the picture above.  Next press the Next Frame button, and then click on the white box again, this time choose the second water tile.   Now press the Previous Frame button, the one to the left of the Next Frame button.   This will take you back to the first frame of your animation, now slide the speed bar a little to the right, like shown in the picture above.  Now press the Play Animation button, the one that looks like a black triangle pointing to the right.  You should see the water moving now.  To stop the animation, just press the stop button the one that looks like a little black square.

Now press the Save Project File button, and save the animated tile as Water1.tan, note the Toolkit adds the .tan to the filename so you know it is a Tile Animation.

Now all you have to do is to load up your Over World map and when you choose the tile to lay down on the map, instead of choosing a tileset tile, just choose the Water1.tan file.   You will notice that up where it shows the current tile, it will show the tile animated, there is a play animation and stop animation button just under the current tile displayed, that you can turn the animation on and off with.  When you click on the board to place the tile, it will not be animated on the board itself.  What I do to keep from missing a tile since they look like the ones already there, is to take a tile like the Magic Scroll tile and place it down first, then overlay it with the animated tile, that way I do not miss placing a water tile.  If you save your board and run the game you should see the tiles you placed animated on the screen.

A little side note for those interested.

What I did to create the tiles to be used in the animations, was to go into the Tile Editor and load up the tile I wanted to animate.  Then I saved it into the DarknessFalls.tst tileset.  Once I did that I clicked on the eraser and erased all the water, but left the shore portion of the tile so everywhere there was water was now transparent.  I then saved this tile into a work tileset I used called ferlin.tst, believe it or not, I usually use the first tile in this set, and just keep overlaying it.  Then I loaded up the water tile from the default.tst tileset.  I then clicked on the Tools menu and chose the rotate option, then I clicked the Tools menu again, and choose the Layer Tile option.   I then chose the tile in my ferlin.tst tileset with the transparent area where the water was, and clicked on the Layer button.  I then saved this tile into the DarknessFalls.tst tileset next to the original tile I started with for this animation.  This created one tile just like the one in the default.tst tileset, and one tile with the water portion rotated.   When placed back to back and swapped over and over it creates the illusion of moving water.

Pretty cool isn't it?  With the water moving it makes the world seem just a little more real.

What's Showing At The Movies?

Creating A Movie Style Introduction.

While we are in here making things look better in our game, why not add a Movie Style Introduction to the game?

There is more than one way to get the Movie Style Introduction effect into a game, one way is to create an AVI file of the introduction, then use the #PlayAvi or the #PlayAviSmall command.  The difference in these commands is the first one will play an AVI file Full screen, while the second one will play the AVI file in a window.   For more information on these commands and how they work, look them up in the RPGCode Reference.   Since most people do not have the software available to create AVI files I opted to use a different approach that I knew all my students could use.

I decided to create our Introduction using a series of graphics files, so I created a whole series of .png files for our Introduction.

Now that we have a series of graphics files, how do we accomplish the look of a Movie Introduction?

Very simple we use the #BitMap command in our start.prg program.   Here is what our new start.prg program looks like, with the changes I have made in BOLD.

*******************************************************
**
** Startup Program For Darkness Falls.
** -----------------------------------
**
*******************************************************

*******************************************************
* Some initial settings.
#Fontsize(12)
#itemwalkspeed("slow")
#walkspeed("slow")
*******************************************************
#include("fadetext.prg")

#BorderColor(0,0,0) *A black border
#Fade(2)

*******************************************************
* Draws the title screen...
#drawtitle()
*******************************************************

*******************************************************
* Waits for the user to choose something...
#done!=0
#While(done!=0)
{
  #MouseClick(x!,y!) *waits for a mouse click and returns x y coords
  #CheckButton(x!,y!,opt!) *checks if we clicked a button
  #if (opt!=0)
  {
    *'new game' clicked
    #YesNo! = 0
    #While(YesNo! == 0)
    {
      #Prompt("Read Background Story (Y/N):",YesNo$)
      #If(YesNo$ == "y")
      {
        #YesNo$ = "Y"
      }
      #If (YesNo$ = "n")
      {
        #YesNo$ = "N"
      }
      #If(YesNo$ == "Y")
      {
        #history()
        #YesNo! = 1
      }
      #If(YesNo$ == "N")
      {
        #YesNo! = 1
      }
    }
    #Color(15)
    #ChoosePlayer()
    #WinGraphic("mwin.jpg") *Message window graphic
    #Fontsize(12)
    #done!=1
    #end
  }
  #if (opt!=1)
  {
    *'load game' clicked
    #dirsav(dest$)
    #if(dest$~="CANCEL")
    {
      #load(dest$)
      #done!=1
      #end
    }
  }
  #if (opt!=2) {#dos}
}
#end

*******************************************************
* This method draws the title screen...
*******************************************************
#method drawtitle()
{
  #Fade(2)
  #SetImage("DFTitle2.jpg",0,0,800,362)
  #midiplay("begin.mid")
  #YesNo! = 0
  #While(YesNo! == 0)
  {
    #Prompt("Play Introduction (Y/N):",YesNo$)
    #If(YesNo$ == "y")
    {
      #YesNo$ = "Y"
    }
    #If (YesNo$ = "n")
    {
      #YesNo$ = "N"
    }
    #If(YesNo$ == "Y")
    {
      #Bitmap("Title01.PNG")
      #Delay(.1)
      #Bitmap("Title02.PNG")
      #Delay(.1)
      #Bitmap("Title03.PNG")
      #Delay(.1)
      #Bitmap("Title04.PNG")
      #Delay(.1)
      #Bitmap("Title05.PNG")
      #Delay(.1)
      #Bitmap("Title06.PNG")
      #Delay(.1)
      #Bitmap("Title07.PNG")
      #Delay(.1)
      #Bitmap("Title08.PNG")
      #Delay(.1)
      #Bitmap("Title09.PNG")
      #Delay(.1)
      #Bitmap("Title10.PNG")
      #Delay(.5)
      #Bitmap("Title11.PNG")
      #Delay(.5)
      #Bitmap("Title12.PNG")
      #Delay(.5)
      #Bitmap("Title13.PNG")
      #Delay(.5)
      #Bitmap("Title14.PNG")
      #Delay(.5)
      #fontsize(30)
      #AppearText(5,7,25,"Introduction To RPG Programming",255,255,255)
      #AppearText(8,8,25,"Proudly Presents",255,255,255)
      #Delay(1)
      #VanishText(5,7,20,"Introduction To RPG Programming",255,255,255)
      #VanishText(8,8,20,"Proudly Presents",255,255,255)
      #Bitmap("Title10.PNG")
      #Delay(.5)
      #Bitmap("Title11.PNG")
      #Delay(.5)
      #Bitmap("Title12.PNG")
      #Delay(.5)
      #Bitmap("Title13.PNG")
      #Delay(.5)
      #Bitmap("Title14.PNG")
      #Delay(.5)
      #AppearText(5,7,25,"A Scarborough / Students",255,255,255)
      #AppearText(8,8,25,"Production",255,255,255)
      #Delay(1)
      #VanishText(5,7,20,"A Scarborough / Students",255,255,255)
      #VanishText(8,8,20,"Production",255,255,255)
      #Bitmap("Title10.PNG")
      #Delay(.5)
      #Bitmap("Title11.PNG")
      #Delay(.5)
      #Bitmap("Title12.PNG")
      #Delay(.5)
      #Bitmap("Title13.PNG")
      #Delay(.5)
      #Bitmap("Title14.PNG")
      #Delay(.5)
      #AppearText(5,7,25,"In Association With",255,255,255)
      #AppearText(8,8,25,"Awsome Computing",255,255,255)
      #Delay(1)
      #VanishText(5,7,20,"In Association With",255,255,255)
      #VanishText(8,8,20,"Awsome Computing",255,255,255)
      #Bitmap("Title10.PNG")
      #Delay(.5)
      #Bitmap("Title11.PNG")
      #Delay(.5)
      #Bitmap("Title12.PNG")
      #Delay(.5)
      #Bitmap("Title13.PNG")
      #Delay(.5)
      #Bitmap("Title14.PNG")
      #fontsize(60)
      #AppearText(1,3,10,"DARKNESS FALLS...",255,0,0)
      #delay(1)
      #VanishText(1,3,10,"DARKNESS FALLS...",255,0,0)
      #delay(.5)
      #Bitmap("Title10.PNG")
      #Delay(.5)
      #Bitmap("Title11.PNG")
      #Delay(.5)
      #Bitmap("Title12.PNG")
      #Delay(.5)
      #Bitmap("Title13.PNG")
      #Delay(.5)
      #Bitmap("Title14.PNG")
      #Delay(.5)
      #fontsize(30)
      #AppearText(5,7,25,"Staring In No Particular Order",255,255,255)
      #Delay(1)
      #Bitmap("Star01.PNG")
      #Delay(.3)
      #Bitmap("Star02.PNG")
      #Delay(.3)
      #Bitmap("Star03.PNG")
      #Delay(.3)
      #Bitmap("Star04.PNG")
      #Delay(.3)
      #Bitmap("Star05.PNG")
      #Delay(.3)
      #Bitmap("Star06.PNG")
      #Delay(.3)
      #Bitmap("Star07.PNG")
      #Delay(.3)
      #Bitmap("Star08.PNG")
      #Delay(.3)
      #Bitmap("Star09.PNG")
      #Delay(.3)
      #Bitmap("Star10.PNG")
      #Delay(.3)
      #Bitmap("Star11.PNG")
      #Delay(.3)
      #Bitmap("Star12.PNG")
      #Delay(.3)
      #Bitmap("Star13.PNG")
      #Delay(.3)
      #Bitmap("Star14.PNG")
      #Delay(.3)
      #Bitmap("Star15.PNG")
      #Delay(.3)
      #Bitmap("Star16.PNG")
      #Delay(.3)
      #Bitmap("Star17.PNG")
      #Delay(.3)
      #Bitmap("Star18.PNG")
      #Delay(.3)
      #Bitmap("Star19.PNG")
      #Delay(.3)
      #Bitmap("Star20.PNG")
      #Delay(.3)
      #Bitmap("Star21.PNG")
      #Delay(.3)
      #Bitmap("Star22.PNG")
      #Delay(.3)
      #Bitmap("Star23.PNG")
      #Delay(.3)
      #Bitmap("Star24.PNG")
      #Delay(.3)
      #Bitmap("Star25.PNG")
      #Delay(.3)
      #Bitmap("Star26.PNG")
      #Delay(.3)
      #Bitmap("Star27.PNG")
      #Delay(.3)
      #Bitmap("Star28.PNG")
      #Delay(.3)
      #Bitmap("Star29.PNG")
      #Delay(.3)
      #Bitmap("Star30.PNG")
      #Delay(.3)
      #Bitmap("Star31.PNG")
      #Delay(.3)
      #Bitmap("Star32.PNG")
      #Delay(.3)
      #Bitmap("Star33.PNG")
      #Delay(.3)
      #Bitmap("Star34.PNG")
      #Delay(.3)
      #Bitmap("Star35.PNG")
      #Delay(.3)
      #Bitmap("Star36.PNG")
      #Delay(.3)
      #Bitmap("Star37.PNG")
      #Delay(.3)
      #Bitmap("Star38.PNG")
      #Delay(.3)
      #Bitmap("Star39.PNG")
      #Delay(.3)
      #Bitmap("Star40.PNG")
      #Delay(.3)
      #Bitmap("Star41.PNG")
      #Delay(.3)
      #Bitmap("Star42.PNG")
      #Delay(.3)
      #Bitmap("Star43.PNG")
      #Delay(.3)
      #Bitmap("Star44.PNG")
      #Delay(.3)
      #Bitmap("Star45.PNG")
      #Delay(.3)
      #Bitmap("Star46.PNG")
      #Delay(.3)
      #Bitmap("Star47.PNG")
      #Delay(.3)
      #Bitmap("Star48.PNG")
      #Delay(.3)
      #Bitmap("Star49.PNG")
      #Delay(.3)
      #Bitmap("Star50.PNG")
      #Delay(.3)
      #Bitmap("Star51.PNG")
      #Delay(.3)
      #Bitmap("Star52.PNG")
      #Delay(.3)
      #Bitmap("Star53.PNG")
      #Delay(.3)
      #Bitmap("Star54.PNG")
      #Delay(.3)
      #Bitmap("Star55.PNG")
      #Delay(.3)
      #Bitmap("Star56.PNG")
      #Delay(.3)
      #Bitmap("Star57.PNG")
      #Delay(.3)
      #Bitmap("Star58.PNG")
      #Delay(.3)
      #Bitmap("Star59.PNG")
      #Delay(.3)
      #fontsize(30)
      #AppearText(8,7,25,"And Introducing",255,255,255)
      #Delay(1)
      #VanishText(8,7,20,"And Introducing",255,255,255)
      #Delay(.5)
      #BitMap("Star60.PNG"
      #Delay(.3)
      #BitMap("Star61.PNG"
      #Delay(.3)
      #BitMap("Star62.PNG"
      #Delay(.3)
      #BitMap("Star63.PNG")
      #Delay(.3)
      #Bitmap("Star64.PNG")
      #Delay(.3)
      #fontsize(30)
      #AppearText(6,7,25,"The Fairy Princess Natalia",255,255,255)
      #Delay(5)
      #YesNo! = 1
    }
    #If(YesNo$ == "N")
    {
      #YesNo! = 1
    }


  #WinGraphic("mwin.jpg")
  #SetImage("DFTitle2.jpg",0,0,800,362)

  #setbutton("new.jpg", 0,123,45,125,30)
  #setbutton("load.jpg",1,248,45,125,30)
  #setbutton("quit.jpg",2,373,45,125,30)
}

* Starts when you click the new game button
#method history()
{
  *Main story
  #fade(3)
  #midiplay("listen.mid")
  #SetImage("DFBackground.jpg",0,0,800,600)
  #fontsize(20)
  #AppearText(1,1,20,"Every 100 years darkness falls over the land of Planetasia. The cause of",255,255,255)
  #AppearText(1,2,20,"darkness is a nearby planet known by the locals as the Devil God Planet.",255,255,255)
  #AppearText(1,3,20,"This planet crosses between the Sun and Planetasia's home world of Abydos,",255,255,255)
  #AppearText(1,4,20,"causing a total eclipse of the Sun. Living in the land of Planetasia is a",255,255,255)
  #AppearText(1,5,20,"family of Faries who down through the years have used their powers to",255,255,255)
  #AppearText(1,6,20,"control the Spirits of the Elements combined with the power of the most",255,255,255)
  #AppearText(1,7,20,"powerful Fairy, the Fiary Princess (who is one with the land) to push",255,255,255)
  #AppearText(1,8,20,"the Devil God Planet back into it's orbit beyond the Sun. This has",255,255,255)
  #AppearText(1,9,20,"happened since the dawn of time, so the people of the land think of it",255,255,255)
  #AppearText(1,10,20,"as just another fact of life, as a matter of fact, they have a big",255,255,255)
  #AppearText(1,11,20,"festival and celebration each time.",255,255,255)
  #AppearText(10,13,20,"Press Any Key.",255,255,0)
  #wait(a$)
  #clear()
  #SetImage("DFBackground.jpg",0,0,800,600)
  #AppearText(1,1,20,"But during the last 100 years, there has been a return to magic in the",255,255,255)
  #AppearText(1,2,20,"land. As some of the people grew more powerful with this magic, they",255,255,255)
  #AppearText(1,3,20,"became more corrupted by it. This led to the Great Magic War where the",255,255,255)
  #AppearText(1,4,20,"wielder of this magic tried to take over the land. As the bitter fight",255,255,255)
  #AppearText(1,5,20,"for control raged on, one very powerful Evil Wizard known as Bob of Apophis",255,255,255)
  #AppearText(1,6,20,"overtook his rivals and struck fear in the hearts of the common people",255,255,255)
  #AppearText(1,7,20,"in the land. Once Bob came into power in the land he demanded that the",255,255,255)
  #AppearText(1,8,20,"people bow down and worship him as their God, as long as they bowed down",255,255,255)
  #AppearText(1,9,20,"to him, he would protect them with his powerful magic.",255,255,255)
  #AppearText(10,13,20,"Press Any Key.",255,255,0)
  #wait(a$)
  #clear()
  #SetImage("DFBackground.jpg",0,0,800,600)
  #AppearText(1,1,20,"So, the people all bowed down to the Almighty Bob. Then there was an",255,255,255)
  #AppearText(1,2,20,"uprising among some of the people, the Rebels as they were known, decided",255,255,255)
  #AppearText(1,3,20,"that the Fairies were the real Gods of the land, since they could control",255,255,255)
  #AppearText(1,4,20,"the elements and their Princess was one with the land. These Rebels were",255,255,255)
  #AppearText(1,5,20,"cast out by Bob of Apophis into the land to fend for themselves. The Evil",255,255,255)
  #AppearText(1,6,20,"Wizard enraged by this Rebel Faction used his magic to capture the Spirits",255,255,255)
  #AppearText(1,7,20,"of the Elements and imprisoned them in stones, which he then scattered",255,255,255)
  #AppearText(1,8,20,"through out the land. Since the Fairy Princess is one with the land, and",255,255,255)
  #AppearText(1,9,20,"the Spirit of the Elements are part of that land, the Fairy Princess grows",255,255,255)
  #AppearText(1,10,20,"weak with the absence of these Spirits. Once the Fairy Princess is weak",255,255,255)
  #AppearText(1,11,20,"Bob of Apophis moves in and takes the Princess as his prisoner.",255,255,255)
  #AppearText(10,13,20,"Press Any Key.",255,255,0)
  #wait(a$)
  #clear()
  #SetImage("DFBackground.jpg",0,0,800,600)
  #AppearText(1,1,20,"So, you ask where do I fit into all this? Recently you started to have",255,255,255)
  #AppearText(1,2,20,"these strange and very disturbing visions of the land slowly dying in",255,255,255)
  #AppearText(1,3,20,"complete darkness. Bob of Apophis sensed these visions you were having",255,255,255)
  #AppearText(1,4,20,"and decided to cast you out to fend for yourself. None of this made any",255,255,255)
  #AppearText(1,5,20,"sense to you, until this morning when a Fairy appeared to you, and revealed",255,255,255)
  #AppearText(1,6,20,"to you that these visions are really Prophesies of what is to come if the",255,255,255)
  #AppearText(1,7,20,"Spirits of the Elements are not returned along with the Fairy Princess and",255,255,255)
  #AppearText(1,8,20,"her Magical Scepter to the Palace of the Fairies. The Fairy tells you that",255,255,255)
  #AppearText(1,9,20,"you are the only hope for the land. Oh, one other thing the Fairy said, if",255,255,255)
  #AppearText(1,10,20,"the land is cast into darkness then the Evil Spirits will be awakened once",255,255,255)
  #AppearText(1,11,20,"again to reak havoc on the land and it's people. Just then....",255,255,255)
  #AppearText(10,13,20,"Press Any Key.",255,255,0)
  #wait(a$)
  #clear()
  #SetImage("DFBackground.jpg",0,0,800,600)
  #fontsize(60)
  #AppearText(1,3,10,"DARKNESS FALLS...",255,0,0)
  #delay(1)
  #VanishText(1,3,10,"DARKNESS FALLS...",255,0,0)
  #delay(.5)
}

#Method ChoosePlayer()
{
  #Clear()
  #Fontsize(12)
  #MWinCls()
  #Mwin("What Gender Do You Want?")
  #Gender! = 0
  #While(Gender! == 0)
  #Mwin(" ")
  #Mwin("1 - Male.")
  #MWin("2 - Female.")
  {
    #Wait(Gender$)
    #If(Gender$=="1")
    {
      #MWin("Male It Is.")
      #Gender! = 1
    }
    #If(Gender$=="2")
    {
      #DestroyPlayer("Alioth.tem")
      #AddPlayer("Lydia.tem")
      #Mwin("Female It Is.")
      #Gender! = 2
    }
  }
}

You might want to print out a copy of the start.prg program, so you can compare it to the one listed above to see any changes that have been made, I may have missed something when I made the changes BOLD.

The first thing I did was to move the #include("fadetext.prg") command higher up in the start program, so that it would be included before the drawtitle method is called.   Since we will be using fading text in the introduction sequence.

The next change I made was to the prompt command in the while loop I changed what the prompt was saying to "Read Background Story (Y/N):" after all it really is not an introduction, it's the background story for our plot.  We are about to add the actual introduction with these changes to the start.prg program.

Then I made the changes you see to the drawtitle method, basically I added a ton of #BitMap commands to display the sequence of graphics files I created, I placed a #Delay command between each one so the sequence would not fly by so fast we would miss it.   I also added a prompt just like the one for the background story, so the player could skip the introduction, after all who wants to watch it every time they start the game if they have already seen it.

At the beginning of the drawtitle method I added a background image and also another of the famous Jonathan Ball Midi files called begin.mid.  The drawtitle method is pretty straight forward and easy to follow.  Told you it was very easy to add a Movie Style Introduction.

A word of caution here, in order for the above code to work, you must have the graphics files and media files in there proper directories.  You need to be sure you have downloaded the DFGraphics6.zip and DFMedia6.zip files and extracted them into the proper directories as instructed near the top of this lecture.

Finally due to a few of the students mentioning to me about the ChoosePlayer method, I have made a little change to it as well.  I took out the #DestroyPlayer and the #AddPlayer commands from the male choice, and changed the #DestoryPlayer command in the female choice to use the Alioth.tem character template.  In order for these changes to the ChoosePlayer method to work you need to set the default character to be Alioth.tem in the Main File, do this by loading up the Main File Editor, you should know how to do this by now, and clicking on the Startup Info Tab, and changing the Initial Character File: field to Alioth.tem just like the picture below.



This makes for a much more efficient ChoosePlayer method.  Thanks to those students who mentioned this.

Some Cautions About The Toolkit.

In the community version of the RPGToolkit there is a little bug with the PakFile Manager.   It does not handle graphics very well, therefore when you pack the game file, you may notice some graphics missing, such as enemy graphics and animations.  Also you may notice your NPCs leave copies of themselves behind when they move around.  Since this is a bug in the PakFile Manager, I will not count it against your grade if these things seem to occur in your .tpk file.

Another word of caution, when you pack the game file using the PakFile Manager it takes EVERY file in the subdirectories for your game and packs them into the .tpk file, so if you have files in these directories that are not used in the game, they are packed anyway, to cut down on the size of the .tpk file, you may want to remove any files not being used by your game.

Well, thats it for another lecture.  This one does not contain as much as the last two did, but the length of the changes to the start.prg program make up for the lack of content.

Stay tuned to this Web Site for the next lecture where we will get into Special Moves and What ever else I have room to add to it.

Please be sure to do any assignments I add to this weeks lecture, and turn them in.



Bye Bye Birdie!

This is the end of the sixth lecture. It is now time for you to continue on to the assignments and to answer any quiz or survey that I might add to this weeks work.

Good luck!

Ferlin