function _init() --initialisierung des spiels
	x = 8
	y = 8
	sfx(0)
end

function _update() --hier passiert die action
	cls()
	-- wurde eine pfeiltaste gedrueckt und ist der weg frei?

	if (btnp(0) and not wand(x-8, y)) then --unten
		x = x-8
		sfx(1)
	end
	if (btnp(1) and not wand(x+8,y)) then --oben
		x = x+8 
		sfx(1)
	end
	if (btnp(2) and not wand(x,y-8)) then --links
		y = y-8
		sfx(1) 
	end
	if (btnp(3) and not wand(x,y+8)) then --rechts
		y = y+8
		sfx(1) 
	end
	schluessel(x,y) --haben wir den schluessel erreicht?
end

function _draw() --hier entsteht das bild
	spr(003,x,y) --sprite wird gemalt
	map(0,0,0,0,16,16) --map wird gemalt
end

function wand(x,y) --haben wir eine wand erreicht?
	wert = mget(x/8,y/8)
	return fget(wert,0)
end

function schluessel(x,y) --haben wir den schluessel erreicht?
	if mget(x/8,y/x) == 2 then
		stop()
	end
end