
# 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    "Demo Level"

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

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

tile	   	@
name		floorstart
image		floorgreen
option		starthere
tile		end

tile	   	,
name		floor
image		bluebrick
tile		end

tile	   	l
name		ladder
image		ladder
option		nograv
tile		end

tile	   	N
name		northwall
image		brownbrick
option		impassable
tile		end

tile	   	n
name		northwall
image		brownbrick
option		impassable_up
tile		end

tile	   	m
name		northwall
image		brownbrick
tile		end

tile	   	E
name		northwall
image		brownbrick
offset_x        17
option		impassable
tile		end

tile	   	S
name		northwall
image		brownbrick
offset_x        34
option		impassable
tile		end

tile	   	W
name		westwall
image		brownbrick
offset_x	51
option		impassable
tile		end

tile	   	Q
name		northwestwall
image		brownbrick
offset_x	68
option		impassable
tile		end

tile	   	-
name		ice
image		bluebrick
offset_x	0
option		slippery
tile		end

tile		x
name		conveyx
conveyer	1           # associate to conveyer 1; no image needed
#image		convey4x
option		autotile    # set up "offset" which *is* honoured for conveyer!
tile		end

tile		y
name		conveyy
conveyer	2           # associate to conveyer 2; no image needed
option		autotile    # set up "offset" which *is* honoured for conveyer!
tile		end

tile		j
name		conveyy2
conveyer	3           # associate to conveyer 3; no image needed
option		autotile    # set up "offset" which *is* honoured for conveyer!
offset_y	16
tile		end

tile		k
name		conveyx2
conveyer	4           # associate to conveyer 4; no image needed
option		autotile    # set up "offset" which *is* honoured for conveyer!
offset_x	16
tile		end

tile		d
name		doorx
door		1	    # associate with door-1
option		autotile
tile		end

door		1	    # door 1
state		closed	    # default state of door is closed
anim_state	open        # define state "open"
  anim_image	door2x	    #   image to use
  offset_x	32	    #   offset in image
anim_state	closed	    # define state "closed"
  anim_image	door2x	    #   image to use
  option	impassable  #   make it impassible while closed
door		end

tile		b
name		buttondoorx
button		1	    # associate with button-1
tile		end

button		1	    # a lever is the same as a button w/ alt. artwork
state		alpha	    # state to begin in
anim_state	alpha
  anim_image	buttongr
  toggle_door	1	    # action to take on exit of state
  option	trigger_entry
  exit_state	beta	    # state to go to after this one
anim_state	beta
  anim_image	buttonor
  exit_state	alpha
  toggle_door	1
  option	trigger_entry
button		end

tile		o
name		buttondoorx
button		2	    # associate with button-1
tile		end

button		2	    # a lever is the same as a button w/ alt. artwork
state		alpha	    # state to begin in
anim_state	alpha
  anim_image	buttonor
  toggle_door	1	    # action to take on exit of state
  option	trigger_control
  exit_state	beta	    # state to go to after this one
anim_state	beta
  anim_image	buttongr
  exit_state	alpha
  toggle_door	1
  option	trigger_control
button		end

sprite		orangekey
door            1	    # unlock door id 1
sprite		end

tile	   	*
name		exit
wayout		1
option		autotile
tile		end

wayout		1
floor		2ndfloor
anim_steps	1
anim_offset_x	0
anim_image	exit
wayout		end

tile	   	=
name		exit
wayout		2
option		autotile
tile		end

wayout		2
floor		mainfloor
anim_steps	1
anim_offset_x	0
anim_image	exit
wayout		end

# make up a floor based on all those tiles
#
tilemap		mainfloor
width		30
height		30
row		QNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
row		W............................N
row		W............................N
row		QNNNNNNNNN....NNNNNNNNNNNNNNNN
row		W,,,,,E..N....E..............N
row		QS,SSSE..N....E......b...o...N
row		W........N....E..............N
row		W........N....EEEEEEE...EEEEEN
row		W........N...............l...N
row		WWWW...NNN.....@.........l...N
row		WWWWW...NN...............l...N
row		W...WW...N...............l...N
row		W....WW..N..N,NNNN...NNNNNNNNN
row		W....WW..N..W,,,,E...N.......N
row		W...........W,NN,E...N.*<....N
row		W...........W,SS,E...N.......N
row		W........N..W,,,,E...N.......N
row		WNNNNNNNNN..SSSSSS...NNNNNNd<N
row		W............................N
row		W............................N
row		W.jx<<x<xxxxxx...............N
row		W.j..........y.............l.N
row		W.^..........^.............l.N
row		W.^..........^.............l.N
row		W.j..........y.............l.N
row		W.^..........^.............l.N
row		W.k<<k<<k<<k<^.............l.N
row		W....................nnnn..l.N
row		W....................mmmm..l.N
row		SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
tilemap		end



# make up a floor based on all those tiles
#
tilemap		2ndfloor
width		20
height		15
option		dark
row		QNNNNNNNNNNNNNNNNNNN
row		W..................N
row		W..................N
row		W..................N
row		W............=<....N
row		W..................N
row		W..................N
row		W..................N
row		W........----------N
row		W..@.....----------N
row		W........----------N
row		W........----------N
row		W........----------N
row		W..................N
row		SSSSSSSSSSSSSSSSSSSS
tilemap		end


# initializer for mainfloor
action-group    27
variable-set _world_friction_x 1
variable-set _world_gravity_y 15
variable-set _player_jumpvelocity_y 175
action-group	end
trigger	        20
on-floor	mainfloor
on-variable-lt _ticks_since_begin 2
action		action-group 27
trigger		end


# add generator to the sprite (sprite is defined in preconfig)
sprite		babagen
gen_id		1           # generator definition to use
sprite		end

# define the generator
generator-list	1	    # id of generator
gen_countdown	30          # number of world ticks before attempt gen
baba		5
generator-list	end


# add generator to the sprite (sprite is defined in preconfig)
sprite		babagen2
gen_id		2           # generator definition to use
sprite		end

# define the generator
generator-list	2	    # id of generator
gen_countdown	30          # number of world ticks before attempt gen
baba		5
generator-list	end


# add generator to the sprite (sprite is defined in preconfig)
sprite		fblauncher
gen_id		3           # generator definition to use
sprite		end

# define the generator
generator-list	3	    # id of generator
gen_countdown	30          # number of world ticks before attempt gen
fireballd	3
generator-list	end



#define tile controller
conveyer        1
group		1
push		left
speed		4
anim_steps	8
anim_offset_x	2
anim_image	convey4x    # use this image for animating this state
conveyer	end

#define tile controller
conveyer        2
group		1
push		up
speed		4
anim_steps	8
anim_offset_y	2
anim_image	convey4y    # use this image for animating this state
conveyer	end

#define tile controller
conveyer        3
group		1
push		down
speed		4
anim_steps	8
anim_offset_y	-2
anim_image	convey4y    # use this image for animating this state
conveyer	end

#define tile controller
conveyer        4
group		1
push		right
speed		4
anim_steps	8
anim_offset_x	-2
anim_image	convey4x    # use this image for animating this state
conveyer	end


# pop out some sprites
sprite-list     mainfloor
baba	        5,22
babagen	        25,25	    # put a sprite at tile (25,25); origin is (1,1)
babagen2        3,9	    # put a sprite at tile (25,25); origin is (1,1)
baba	        3,2
orangekey	3,27
pushwall	22,8
pushwall	23,8
pushwall	24,8
fireballd	2,12
alpha           12,10
spinner		2,2
spinner		10,2
spinner		18,2
spinner		26,2
sprite-list	end

# pop out some sprites
sprite-list     2ndfloor
baba	        5,5
babagen	        15,05	    # put a sprite at tile (25,25); origin is (1,1)
baba	        3,2
fblauncher	3,3
sprite-list	end

# set up a talk tree
text-menu       1
preamble	"You're playing Zot; this is the dialog preamble section and below should be options"
"we're in menu one"	goto-text	2
"goto 2nd floor"	goto-floor	2ndfloor
"quit dialog"   end-dialog
text-menu	end

text-menu	2
preamble	"You're playing Zot (this is second menu); this is the dialog preamble section and below should be options"
"we're in menu two"	goto-text	1
"hoopy groknards"	goto-text	1
"quit dialog"   action-group		7
text-menu	end

action-group	9
end-dialog
action-group	end

action-group	7
end-dialog
action-group	end

action-group	10
post-message	"Welcome to 6,5" 3
post-message	"Second action.. after Welcome" 3
goto-text	1
variable-set	foobar 0
variable-set	_player_speed 5
action-group	end

trigger		1
on-player-entry	5,6
on-floor	mainfloor
on-variable-equals	foobar	5
action		action-group 10
option		disabled
trigger		end

action-group	999
variable-add    foobar 1
trigger-change  1 1
post-message    "here * '$foobar$foobar'" 3
action-group	end

trigger		2
on-player-entry	5,6
on-floor	mainfloor
action		action-group 999
trigger		end
