Odyc.js

🎬 Title & End Screen

The message box is used to display information like the game title when starting up, or an end message when the player wins or loses.

Title screen example

✏️ Title screen

When the game starts, you can show a title screen using the title property:

createGame({
	title: 'My Awesome Game'
})

To add line breaks, use a multiline string:

createGame({
	title: `** AN AWESOME GAME **






        by John Doe`
})

🏁 Ending the game

To end the game when the player touches a specific element, use the end property in a template. The message will be shown, and then the game will restart from the beginning.

createGame({
	templates: {
		X: {
			sprite: 2,
			end: 'The End...'
		}
	}
})

Note

If you want to end the game without showing a message, you can use end: true.


🪄 Showing multiple messages

You can display several messages in sequence by using an array of strings:

createGame({
	title: ['An awesome game', 'by John Doe']
})
createGame({
	templates: {
		X: {
			sprite: 2,
			end: ['You lost', 'Game Over...']
		}
	}
})

💥 Add effects and colors

Just like with dialogues, you can enhance the text with colors and animations.

Note

See the dialogue formatting section for more details.