Skip to content

Demo 01 Construction

nhmkdev edited this page Mar 5, 2014 · 13 revisions

Description

Demo 01 is a very simple level but has a lot going on in the background in relation to the support system.

Spawn Points ( Playerspawn )

Left Spawn Point

This is the initial spawn point for the entire demo/level.

Setting Value
default 1
id 1

Right Spawn Point

This Spawn Point is intended for when the player loads into the level from demo02. This also sets the player facing so when they arrive they are flipped the direction they would have been when leaving the demo02. Additionally this spawn point uses the last y position and velocity so a player can jump through the doorway between demo01 to demo02 arriving in the same state as the left.

Setting Value
id 2
face l
usey 1
usev 1

Show Dialog with options (Showdialog)

The Showdialog entity triggers the display of a Dialog. In this instance the sid value is used to make sure the Dialog is only displayed once (see the Save system for more information on the sid). The Dialog to be displayed is defined in Dialogs.demo.d1 in the data files.

Entity Settings/Data

Setting Value
dialog demo.d1
sid dlg.d1

To cut down on duplication the data for the demo.d1 Dialog uses a base object and additionally another shared object. The speakerBase defines the core settings of the Dialog including the layout and Windows.

speakerBase =
{
	f:'04b03.font',
	w:210,
	h:0,
	x:90,
	y:15,
	osx:5,
	osy:6,
	win: [ Windows.textbg, Windows.facebg ]
}

The actual settings object takes advantage of the base functionality and expands the settings as necessary.

speakerBaseSeq =
{
	base:speakerBase,
	seq:true, // adds sequential flag
	winex: [ Windows.face ] // adds the face to the dialog
}

The definition of the object is simplified to just referencing the central speakerBaseSeq object for all of the settings. The actual Dialog is not branching as the options presented perform no actions nor lead to any specific states. For this sample this is just a sequential Dialog that displays each state.

Dialogs.demo.d1 =
{
	s:speakerBaseSeq,
	sa:
	[
		{
			t:'Welcome to the demo! Select an option to continue. Both lead to the same thing!',
			o:
			[
				{ t:'Option Sample 1' },
				{ t:'Option Sample 2'}
			]
		},
		{
			t:"Be sure to jump over the hole so you don't die and respawn. Though you can certainly try falling in..."
		},
		{
			t:"This dialog trigger will now go away so you won't hit it again.",
			a:{k:true}
		}
	]
}

Kill entity ( and LevelManager )

The kill entity forces the player to re-spawn at the last save checkpoint. For the purposes of the demo the save checkpoint is updated every time a level loads (see LevelManager.updateSpawnPoint ).

Level exit

The level exit is a very simple entity forcing the load of another level at a specific Spawn Point (the id is specified in targetid).

Setting Value
level demo02
targetid 1
Clone this wiki locally