--position load
file = io.open("./saved_data/position.txt", "r")
place = file:read(12)
playerx = file:read("*n")
playery = file:read("*n")

for bgs = 1, 10 do 
	BG[bgs].x = file:read("*n")
	BG[bgs].y = file:read("*n")
end
file:close()
--pokemon load
--pokemon 1
file = io.open("./saved_data/pokemon/pokemon1/pokemonname.txt", "r")
pokemon[1].name = file:read()
file:close() 
file = io.open("./saved_data/pokemon/pokemon1/pokemonstats.txt", "r")
pokemon[1].lv = file:read("*n")
pokemon[1].STR = file:read("*n")
pokemon[1].DEF = file:read("*n")
pokemon[1].AGI = file:read("*n")
pokemon[1].SPA = file:read("*n")
pokemon[1].SPD = file:read("*n")
pokemon[1].MAX_HP = file:read("*n")
pokemon[1].C_HP = file:read("*n")
pokemon[1].exp = file:read("*n")
file:close()


pokemon[1].pic = Image.load("./pokemon/" .. pokemon[1].name .. "/" .. pokemon[1].name .. ".png")
pokemon[1].picB = Image.load("./pokemon/" .. pokemon[1].name .. "/" .. pokemon[1].name .. "_back.png")
file = io.open("./saved_data/pokemon/pokemon1/attacks/" .. 1 .. ".txt", "r")
p_attacks[101].name = file:read()
file:close()
file = io.open("./saved_data/pokemon/pokemon1/attacks/" .. 2 .. ".txt", "r")
p_attacks[102].name = file:read()
file:close()
file = io.open("./saved_data/pokemon/pokemon1/attacks/" .. 3 .. ".txt", "r")
p_attacks[103].name = file:read()
file:close()
file = io.open("./saved_data/pokemon/pokemon1/attacks/" .. 4 .. ".txt", "r")
p_attacks[104].name = file:read()
file:close()


--pokemon2

file = io.open("./saved_data/pokemon/pokemon2/attacks/" .. 1 .. ".txt", "r")
p_attacks[201].name = file:read()
file:close()
file = io.open("./saved_data/pokemon/pokemon2/attacks/" .. 2 .. ".txt", "r")
p_attacks[202].name = file:read()
file:close()
file = io.open("./saved_data/pokemon/pokemon2/attacks/" .. 3 .. ".txt", "r")
p_attacks[203].name = file:read()
file:close()
file = io.open("./saved_data/pokemon/pokemon2/attacks/" .. 4 .. ".txt", "r")
p_attacks[204].name = file:read()
file:close()








file = io.open("./saved_data/pokemon/pokemon2/pokemonname.txt", "r")
pokemon[2].name = file:read()
file:close() 
file = io.open("./saved_data/pokemon/pokemon2/pokemonstats.txt", "r")
pokemon[2].lv = file:read("*n")
pokemon[2].STR = file:read("*n")
pokemon[2].DEF = file:read("*n")
pokemon[2].AGI = file:read("*n")
pokemon[2].SPA = file:read("*n")
pokemon[2].SPD = file:read("*n")
pokemon[2].MAX_HP = file:read("*n")
pokemon[2].C_HP = file:read("*n")
pokemon[2].exp = file:read("*n")
file:close()
if pokemon[2].MAX_HP ~= 0 then
pokemon[2].picB = Image.load("./pokemon/" .. pokemon[2].name .. "/" .. pokemon[2].name .. "_back.png")
end



file = io.open("./saved_data/items.txt")
items[1].amount = file:read("*n")
pokeballs[1].amount = file:read("*n")
file:close()

file = io.open("./saved_data/gender.txt", "r")
gender = file:read()
file:close()
