dofile ("lua/libFenetre.lua")

RPGdatabase ()

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

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

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

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

x = 0
y = 0

var = 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.held and Stylus.X > 0 and Stylus.X < 60 and Stylus.Y > 40 and Stylus.Y < 100 then
Image.destroy(img)
img = nil
Image.destroy(bouton)
bouton = nil
Image.destroy(bouton2)
bouton2 = nil
x = nil
y = nil
var = nil
Sound.unloadSFX(0)
Sound.unloadBank()

dofile("lua/chargement.lua")
end

if Stylus.held and Stylus.X > 90 and Stylus.X < 150 and Stylus.Y > 40 and Stylus.Y < 100 then
Image.destroy(img)
img = nil
Image.destroy(bouton)
bouton = nil
Image.destroy(bouton2)
bouton2 = nil
x = nil
y = nil
var = nil
Sound.unloadSFX(0)
Sound.unloadBank()
dofile("lua/CM.lua")
end
	screen.blit(SCREEN_DOWN, 0, 0, fond)
	screen.blit(SCREEN_UP, x, y, img)
	screen.blit(SCREEN_DOWN, 0, 40, bouton)
		screen.blit(SCREEN_DOWN, 90, 40, bouton2)

	
stopDrawing()
end


Image.destroy(img)
img = nil
Image.destroy(bouton)
bouton = nil
Image.destroy(bouton2)
bouton2 = nil
x = nil
y = nil
var = nil
Sound.unloadSFX(0)
Sound.unloadBank()
