dofile ("lua/libFenetre.lua")

RPGdatabase ()

img = Image.load("lua/images/digimon ľarena.PNG", VRAM)

bouton = Image.load("lua/images/boutonkabuterimon.PNG", VRAM)

bouton2 = Image.load("lua/images/boutoncannondramon.PNG", VRAM)



curseur = Image.load("lua/images/curseur2.PNG", VRAM)

fond = Image.load("lua/images/fond.png", VRAM)

x = 0
y = 0

Sound.loadBank("lua/son/soundbank.bin")
-- Load all mods and sfx in ram
Sound.loadSFX(0)
Sound.startSFX(0)

while true do
startDrawing()
	Controls.read()

if Stylus.released and Stylus.X > 0 and Stylus.X < 60 and Stylus.Y > 0 and Stylus.Y < 60 then

Sound.unloadSFX(0)
Sound.unloadBank()
    file4 = io.open("lua/save/mp.txt", 'r')
    if file4 then
    heros.a.mp = file4:read()
    file4:close()
    else
    heros.a.mp = 50
    end	  
dofile("lua/testbattle7.lua")
end

if Stylus.released and Stylus.X > 90 and Stylus.X < 150 and Stylus.Y > 0 and Stylus.Y < 60 then

Sound.unloadSFX(0)
Sound.unloadBank()
    file4 = io.open("lua/save/mp.txt", 'r')
    if file4 then
    heros.a.mp = file4:read()
    file4:close()
    else
    heros.a.mp = 50
    end	  
dofile("lua/testbattle8.lua")
end



if Stylus.released and Stylus.X > 0 and Stylus.X < 6 and Stylus.Y > 63 and Stylus.Y < 78 then

Sound.unloadSFX(0)
Sound.unloadBank()
dofile("lua/CC.lua")
end

	screen.blit(SCREEN_DOWN, 0, 0, fond)
	screen.blit(SCREEN_UP, x, y, img)
	screen.blit(SCREEN_DOWN, 0, 0, bouton)
    screen.blit(SCREEN_DOWN, 90, 0, bouton2)
	screen.blit(SCREEN_DOWN, 0, 65, curseur)
	

stopDrawing()

end


Image.destroy(img)
img = nil
Image.destroy(bouton)
bouton = nil
Image.destroy(bouton2)
bouton2 = nil
Image.destroy(bouton3)
bouton3 = nil
Image.destroy(bouton4)
bouton4 = nil
Image.destroy(bouton5)
bouton5 = nil
Image.destroy(bouton6)
bouton6 = nil
Image.destroy(fond)
fond = nil
Image.destroy(curseur)
curseur = nil
x = nil
y = nil
Sound.unloadSFX(0)
Sound.unloadBank()
