blue = Color.new(56,172,236)
textbox = Image.load("talkbox.png")

BG = {}
BG[1] = {x = 0, y = 0, pic = Image.load("Neptarento-1.png")}
BG[2] = {x = 0, y = 270, pic = Image.load("Neptarento-2.png")}
BG[3] = {x = 480, y = 0, pic = Image.load("Neptarento-3.png")}
BG[4] = {x = 480, y = 270, pic = Image.load("neptarento-4.png")}
move = true
chars = {}
chars[1] = {x = 468, y = 300, pic = Image.load("./characters/OAK.png")}



Player= {}
Player[1]= {x =0, y = 0}
image = {}
image[1] = Image.load("char1-fstand.png")
image[2] = Image.load("char1-fright.png")
image[3] = Image.load("char1-fleft.png")
image[4] = Image.load("char1-bright.png")
image[5] = Image.load("char1-bstand.png")
image[6] = Image.load("char1-lright.png")
image[7] = Image.load("char1-lstand.png")
image[8] = Image.load("char1-rright.png")
image[9] = Image.load("char1-rstand.png")
y = 0
x = 3
counter = 0
counts = Timer.new()
w = o
r = 0
run = 0
ani = 0
tk = 0
place = 0
i = 0
player_direction = 1
xy = 0
counts:start()
while true do
	CurrentTime = counts:time()
	screen:clear()
	pad = Controls.read()
for blit_slides = 1, 4 do
	screen:blit(BG[blit_slides].x, BG[blit_slides].y, BG[blit_slides].pic) 
end
screen:blit(240,135,image[player_direction])
screen:blit(chars[1].x,chars[1].y,chars[1].pic)



if place == 0 then
	if pad:left() and BG[1].x <= 240 then		

		if CurrentTime % 2 == 0  then
			player_direction = 6
			Player[1].x = Player[1].x + 1
			chars[1].x = chars[1].x + 1
			for move_slides = 1, 4 do
				BG[move_slides].x = BG[move_slides].x +1

				end
		else
			player_direction = 7
			Player[1].x = Player[1].x +1
			chars[1].x = chars[1].x +1
			for move_slides = 1, 4 do
				BG[move_slides].x = BG[move_slides].x +1
				
					
			end
		end
	end
	if pad:right() then
		if BG[1].x >= -287 then
				if CurrentTime % 2 ==0 then
					player_direction = 8
					Player[1].x = Player[1].x -1
					chars[1].x = chars[1].x -1
					for move_slides = 1, 4 do
						BG[move_slides].x = BG[move_slides].x -1

					end	
				else
					player_direction = 9
					Player[1].x = Player[1].x -1
					chars[1].x = chars[1].x -1
					for move_slides = 1, 4 do
						BG[move_slides].x = BG[move_slides].x -1
						
						
					end
				end	
		end

	end
	if pad:up() and BG[1].y <= 100 then

		if CurrentTime % 2 ==0 then
 			player_direction = 4
			Player[1].y = Player[1].y +1
			chars[1].y = chars[1].y +1
			for move_slides = 1, 4 do
				BG[move_slides].y = BG[move_slides].y +1

			end
		else 	
			player_direction = 5
			Player[1].y = Player[1].y +1
			chars[1].y = chars[1].y +1
			for move_slides = 1, 4 do
				BG[move_slides].y = BG[move_slides].y +1 

				
			end
		end
			
	end


	if pad:down() and BG[1].y >= -337 then
		if CurrentTime % 2 == 0 then 
			player_direction = 1
			Player[1].y = Player[1].y -1
			chars[1].y = chars[1].y -1
			for move_slides = 1, 4 do
				BG[move_slides].y = BG[move_slides].y -1 

			end
		else
			player_direction = 2
			chars[1].y = chars[1].y -1
			for move_slides = 1, 4 do
				BG[move_slides].y = BG[move_slides].y -1
				Player[1].y = Player[1].y -1
				
			end
		end	
	end
	if io.stdin:read =='a' and Player[1].x <= -200 and Player[1].x >= -270 then 
		if Player[1].y <= -386 and Player[1].y >=-406 then
			screen:blit( 71,170, textbox)
			screen:print(101,190,"Hello and welcome to the wonderful world of Pokemon",blue)
			screen:print(101, 210, "pokemon are domesticated monsters that come in all shapes and sizes, they can be used for", blue)
			
			screen:print(101, 230, "great pets a lot of people also use them for numerous competitions", blue)
		end	
	
	end
end

screen.waitVblankStart()
screen.flip()
oldpad = pad
end