Adventure Call - Custom Text adventure w/ Fonts, Start Screen and BGM!

I know some people like to skip through the early exercises as quickly as possible, but I am a firm beleiver that if you are going to do something that you should do it propperly (or at least make it look like you tried ;))!

Anyway, for the Text101, I decided to adapt a scetch from ‘Limmy’s Show!’ because it was the first thing that came into my head (See for reference: https://www.youtube.com/watch?v=kkxGynvgvRU). It was supposed to be funny, but ended up as some sort of creepy abomination - so sorry about that. Either way, I had a blast making it and learned a lot by trying to add some new features including:

  • A new image,
  • A new font,
  • A start screen and,
  • Background music.

Anyway without further ado, please try it out and give me some feedback!

http://gamebucket.io/game/cd91d2a0-0bc1-4f81-97b6-298b9013b51a


P.S. I wanted to make the image change with the text. I had a quick look and tried a few things, but all the solutions were a little above my current level. Does anyone know if there is a straight forward way to script for this?

~Thom

You would need a component with references to the textures you want to swap out. Then it should be straightforward to achieve in code.

@sampattuzzi

Do you know where I could look for further information? I’m sure this will be covered later in the course, but since I’m curious it would be good knowledge to gain now.

Any chance you could explain in more detail?

~Thom

One straightforward way to change images is to create multiple images and to use the ‘enable = true/false’ command to turn them on or off.

If you look at an image in the Unity editor, you can see in the Inspector that its Image section has a tick box - if you untick this the image is not displayed. So if you want to use, say, four different images you can create them all, within the UI Canvas of course, but just show one at a time as you position them and get them right in the editor.

In your text script, just below the public Text line, add a series of lines for your images, along the lines of:

public Text  textBox;                 // Not quite the same name as the course uses
public Image deathPicSpdr;
public Image deathPicPit;
public Image deathPicCyc;
public Image escapePic;

Then, in the Unity editor, just as you dragged the text component into the Text entry for the script, now you also drag each of the image components into its corresponding image entry. This links your script to the different pictures.

Within your state routines in the script, as well as displaying text you can now turn pictures on or off:

	deathPicSpdr.enabled = 	false;
	deathPicPit.enabled = 	false;
	deathPicCyc.enabled = 	false;
	escapePic.enabled = 	true;	

If you have too many pictures this gets tedious and you need to play around to optimise the code, but as a basic approach it seems to work for me.

1 Like

That’s fantastic! It solves my issue.

Thanks a lot!

~Thom

Privacy & Terms