playerx = 230
playery = 240
pokecenter = 0
talkcounter = 0
while place == "Pcenter_____" do
pad = Controls.read()
screen:blit(0,0,BG[11].pic)
screen:blit(playerx,playery,image[player_direction])
if pad:left() and playerx >= 121 then
	moveleft()
	playerx = playerx -1


--leftguy
if playerx == 151 and playery <= 170 then
playerx = playerx +1
end
--right desk
if playerx == 295 and playery <= 170 then
playerx = playerx + 1
end
--bottom guy
if playerx == 200 and playery <=236  and playery >= 202 then
playerx = playerx + 1
end
--escelator
if playerx == 153 and playery >= 179 and playery <= 233 then
playerx = playerx + 1
end
--table
if playerx == 328 and playery >=191 and playery <=235 then
playerx = playerx + 1
end
--rightguy
if playerx == 328 and playery >= 171 and playery <=211 then
playerx = playerx +1
end
--PC
if playerx == 313 and playery <= 151 then
playerx = playerx +1
end
end
if pad:right() and playerx <= 342 then
	moveright()
	playerx = playerx +1
--left desk
if playerx == 167 and playery <= 170 then
playerx = playerx - 1
end
-- leftguy
if playerx == 121 and playery <= 174 then
playerx = playerx - 1
end
--bottomguy
if playerx == 166 and playery <=236  and playery >= 202 then
playerx = playerx -1
end
--table
if playerx == 280 and playery >=191 and playery <=235 then
playerx = playerx - 1
end
-- right guy
if playerx == 297 and playery >= 171 and playery <=211  then
playerx = playerx - 1
end

end
if pad:up() and playery >= 138 then
	moveup()
	playery = playery -1
--bookcase
if playery == 151 and playerx <=166 then
playery = playery +1
end
--deskbottom
if playery == 170 and playerx <= 295 and playerx >= 167 then
playery = playery +1
end
--leftguy
if playery == 175 and playerx <= 151 and playerx >=121 then
playery = playery +1
end
--bottomguy
if playery == 236 and playerx <= 200 and playerx >= 166 then
playery = playery +1
end
--escelator
if playery == 232 and playerx <= 153 and playerx >= 119 then
playery = playery +1
end
--table 
if playery == 235 and playerx <= 328 and playerx >=280 then
playery = playery +1
end
--PC
if playery == 150 and playerx <= 313 and playerx >= 296 then
playery = playery +1
end
end
if pad:down() and playery <=238 then
	movedown() 
	playery = playery +1

--escalator
if playery == 233 and playerx <= 153 and playerx >= 119 then
playery = playery -1
end
--bottom guy
if playery == 236 and playerx <= 200 and playerx >= 166 then
playery = playery -1
end
--table
if playery == 235 and playerx <= 328 and playerx >=280 then
playery = playery -1
end
-- right guy
if playery == 211 and playerx <= 297 and playerx >=328 then
playery = playery -1
end
-- door
if playery == 238 and playerx >= 213 and playerx <= 251 then
place = "plutanium___"

end
end
if pad:l() and oldpad:l() ~= pad:l() then
dofile("./start_pressed.lua")
end
if pad:r() and oldpad:r() ~= pad:r() and playerx >= 222 and playerx <= 243 and playery == 171 then
	if pokecenter ~= 3 then
	pokecenter = 1
	end
end
if pokecenter == 1 then
	talkcounter = talkcounter +1
	screen:blit(71, 170, textbox)
	screen:print(101, 190, "We'll be happy to fully heal your pokemon", blue)
	if pad:r() and oldpad:r() ~= pad:r() and talkcounter >= 5 then
		talkcounter = 0
		pokecenter = 2
	end
end
if pokecenter == 2 then
	talkcounter = talkcounter +1
	screen:blit(71, 170, textbox)
	screen:print(101, 190, "there all done", blue)
	for pokeheal = 1, 6 do
		pokemon[pokeheal].C_HP = pokemon[pokeheal].MAX_HP
	end
	if talkcounter >= 8 then
	pokecenter = 3
	end

end


screen:print(0,0,playerx .. "  " .. playery, blue)
screen.waitVblankStart()
screen.flip()
oldpad = pad
end