
# CONFIG
# This configuration defines a level or group of related levels; it depends
# on the preconfig config file being loaded; this config only populates the
# world with already defined objects.. those objects should be defined in the
# preconfig if they are generic. If they belong only in this level, perhaps
# they should be defined here..
#

# include preconfig config
config-read	preconf.txt

# post intro messages
post-message    "A Zot to the Past"
post-message    "Artwork by Nintendo(tm)"

# which floor are we starting on in this level?
startmap        house

# define the tiles for use on floors in this config
#
tile	   	.
name		floor
image		intile
tile		end

tile	   	B
name		bl
image		inwallbl
option		autotile
option		impassable
tile		end

tile	   	b
name		b
image		inwallb
option		autotile
option		impassable
tile		end

tile	   	t
name		t
image		inwallt
option		autotile
option		impassable
tile		end

tile	   	R
name		br
image		inwallbr
option		autotile
option		impassable
tile		end

tile	   	T
name		tr
image		inwalltr
option		autotile
option		impassable
tile		end

tile	   	L
name		tl
image		inwalltl
option		autotile
option		impassable
tile		end

tile	   	l
name		l
image		inwalll
option		autotile
option		impassable
tile		end

tile	   	r
name		r
image		inwallr
option		autotile
option		impassable
tile		end

tile	   	@
name		floorstart
image		intile
option		starthere
tile		end

tile	   	d
name		door
image		indoor
option		autotile
tile		end

tile	   	s
name		bed
image		inbed
option		autotile
option		impassable
tile		end

tile	   	e
name		table
image		intable
option		autotile
option		impassable
tile		end

tile	   	c
name		chair
image		inchair
option		impassable
tile		end

tile	   	w
name		well
image		inwell
option		impassable
option		autotile
tile		end

sprite		orangekey
#door            1	    # unlock door id 1
sprite		end

# make up a floor based on all those tiles
#
tilemap		house
width		20
height		15
row		L<ttttttttttttttttT<
row		^^^^^w<^^^^^^^^^^^^^
row		l<...^^...........r<
row		l<..........cs<c..r<
row		l<..........@^^...r<
row		l<...........^^...r<
row		l<................r<
row		l<..c.c...........r<
row		l<................r<
row		l<..e<<...........r<
row		l<..^^^...........r<
row		l<..ccc...........r<
row		l<................r<
row		B<bbbbbbbd<bbbbbbbR<
row		^^^^^^^^^^^^^^^^^^^^
tilemap		end

# pop out some sprites
sprite-list     house
orangekey	10,4
#knight		12,12
#guard		12,13
#mummy		12,12
#piller		12,12
sprite-list	end



# set up initial intro dialog
text-menu       1
avatar-image	avatar
avatar-name	Wink
preamble	"What a nice spring day .. wait! Oh no! Someone has stolen the 4 nightjewels! Without them, we can't end the day!"
"Better find them!"   goto-text 2
text-menu	end

text-menu       2
avatar-image	avatar
avatar-name	Wink
preamble	"Hmmm! They must be outside somewhere .."
"Let's go!"	end-dialog
text-menu	end

text-menu       3
avatar-image	avatar
avatar-name	Wink
preamble	"Agh, I've died!"
"Exit :("	end-game
"Continue .."	end-dialog
text-menu	end

text-menu       4
avatar-image	avatar
avatar-name	Wink
preamble	"Found all the jewels!"
"You win! (Exit)"	end-game
"Continue .."	end-dialog
text-menu	end


# initializer for house; a few moments into the game, bring up the story
trigger	        100
on-variable-equals _ticks_since_begin 10
action		   variable-set	   player-health 200
trigger		end
trigger	        101
on-variable-equals _ticks_since_begin 10
action		   variable-set	   jewels 0
trigger		end

trigger	        1
on-floor	house
on-variable-equals _ticks_since_begin 60
action		goto-text 1
trigger		end

trigger		2
on-pickup-sprite	orangekey
action			action-group 2
trigger		end
action-group	2
post-message    "I'll need this soon!" 3
variable-set    housekey_got	1
action-group	end

# include out-doors config
config-read	outside.txt

# if in the house and we go to the door, change to outside
trigger		3
on-variable-equals	housekey_got	1
on-player-entry	10,13
on-floor	house
action		goto-floor	outside
trigger		end

# going back home
action-group	4
goto-floor	house
variable-set	_player_x	160
variable-set	_player_y	160
action-group	end
trigger		4
on-player-entry	11,11
on-floor	outside
action		action-group	4
trigger		end

# combat
#
score		player-score
health		player-health

# when bullet hits key
action-group    5
variable-sub    _into.health	5
variable-add    player-score	10
make-sprite	minus5 _into
action-group	end
trigger		5
when-collide	arrow	orangekey
action		action-group 5
trigger		end

# when key dies..
action-group	6
post-message    "I needed that!" 3
kill            _mob
action-group	end
trigger		6
when-ltezero	orangekey	health
action		action-group 6
trigger		end

# knight combat
#
action-group    10
variable-sub    _into.health	5
variable-add    player-score	10
make-sprite	minus5 _into
action-group	end
trigger		10
when-collide	arrow	knight
action		action-group 10
trigger		end

action-group    13
variable-sub    player-health	5
#post-message	"owww!" 3
make-sprite	minus5 _into
action-group	end
trigger		13
on-variable-gt	player-health 0
when-collide	knight player
action		action-group 13
trigger		end

# knight dies
#
action-group	11
post-message    "hahaha!" 1
kill            _mob
action-group	end
trigger		11
when-ltezero	knight	health
action		action-group 11
trigger		end

# guard combat
#
action-group    21
variable-sub    _into.health	5
variable-add    player-score	10
make-sprite	minus5 _into
action-group	end
trigger		21
when-collide	arrow	guard
action		action-group 21
trigger		end

# guard dies
#
action-group	22
post-message    "He was tough!" 1
kill            _mob
action-group	end
trigger		22
when-ltezero	guard	health
action		action-group 22
trigger		end

# mummy combat
#
action-group    31
variable-sub    _into.health	5
variable-add    player-score	10
make-sprite	minus5 _into
action-group	end
trigger		31
when-collide	arrow	mummy
action		action-group 31
trigger		end

action-group    43
variable-sub    player-health	5
#post-message	"owww!" 3
make-sprite	minus5 _into
action-group	end
trigger		43
on-variable-gt	player-health 0
when-collide	mummy player
action		action-group 43
trigger		end

# mummy dies
#
action-group	32
variable-add    player-score	15
kill            _mob
action-group	end
trigger		32
when-ltezero	mummy	health
action		action-group 32
trigger		end

# piller combat
#
action-group    33
variable-sub    _into.health	5
variable-add    player-score	10
make-sprite	minus5 _into
action-group	end
trigger		33
when-collide	arrow	piller
action		action-group 33
trigger		end

action-group    44
variable-sub    player-health	5
#post-message	"owww!" 3
make-sprite	minus5 _into
action-group	end
trigger		44
on-variable-gt	player-health 0
when-collide	piller player
action		action-group 44
trigger		end

# piller dies
#
action-group	34
variable-add    player-score	15
make-sprite	jewel	50,30
kill            _mob
action-group	end
trigger		34
when-ltezero	piller	health
action		action-group 34
trigger		end

# player dies
#
action-group	35
goto-text	3
action-group	end
trigger		35
on-variable-gt _ticks_since_begin 100
on-variable-lt	player-health 5
action		action-group 35
trigger		end

# player wins
#
action-group 37
variable-add jewels 1
post-message "I've found a nightjewel!" 3
action-group end
trigger 37
on-pickup-sprite jewel
action		 action-group 37
trigger	end

action-group	36
goto-text	4
action-group	end
trigger		36
on-variable-equals	jewels 4
action		action-group 36
trigger		end

action-group	75
post-message	"You hear a rumble!" 3
make-sprite	piller	  50,30
action-group	end
trigger		75
on-variable-equals	jewels 3
action		action-group 75
trigger		end

# pop out some sprites
sprite-list     outside
jewel	90,5
jewel	90,55
jewel	9,54
knight		20,29
knight		30,20
knight		30,30
knight		50,40
knight		80,30
knight		90,50
knight		10,40
knight		20,30
knight		40,30
knight		50,20
knight		40,30
knight		20,30
knight		40,30
knight		50,20
knight		10,19
knight		40,30
#guard		12,13
#mummy		12,12
#piller		12,12
mummy		20,20
mummy		30,20
mummy		30,30
mummy		50,40
mummy		80,30
mummy		90,50
mummy		10,40
mummy		20,30
mummy		40,30
mummy		50,40
mummy		10,50
mummy		20,30
mummy		40,30
mummy		50,40
mummy		10,50
mummy		40,30
sprite-list	end

# hurt player and player death
# jewels to win
# boss and spawn
# levels
