class Object(object):
class CanvasWidget(QtWidgets.QWidget):
class Stage(Object):
class KeyCode(object):
class UnityOfDictAndClass(object):
	def __init__(self):
	def _nonCopyableAttrs(self):
	def copyFrom(self, source):
	def __init__(self):
	def paintEvent(self, event):
	def mousePressEvent(self, event):
	def mouseMoveEvent(self, event):
	def mouseReleaseEvent(self, event):
	def mouseDoubleClickEvent(self, event):
	def keyPressEvent(self, event):
	def keyReleaseEvent(self, event):
	def __enterKeyboardEvent(self, event, eventType):
	def __enterMouseEvent(self, event, eventType):
	def __init__(self):
	def copyFrom(self, source):
	def _setCanvas(self, speed, title, width, height):
	def _onShow(self):
	def _showDisplayList(self, childList):
	def _enterMouseEvent(self, event, cd):
	def setFrameRate(self, speed):
	def addChild(self, child):
	def removeChild(self, child):
	def addEventListener(self, e, listener):
	def removeEventListener(self, e, listener = None):
	def __init__(self):
	def __init__(self):
	def set(obj, key, value):
	def get(obj, key):
	def has(obj, key):
def init(speed, title, width, height, callback):
def addChild(child):
def removeChild(child):
def getColor(color):
def removeItemsInList(theList, condition):
	PARENT = "stage_parent_root" class LoadManage(Object):
	delay = 50
	IMAGE_EXTENSION = ["png", "jpg", "jpeg", "bmp", "gif"]
	MEDIA_EXTENSION = [
		"aif", "cda", "mid", "midi", "mp3", "mpa", "wav", "ogg", "wma", "m4a",
		"avi", "flv", "m4v", "mkv", "mov", "mp4", "mpg", "mpeg", "swf", "vob", "wmv"
	]

	def __init__(self):
		raise Exception("LoadManage cannot be instantiated.")

	@staticmethod
	def load(loadList, onUpdate = None, onComplete = None):
		worker = LoadManageWorker()
		worker.load(loadList, onUpdate, onComplete) class Sprite(DisplayObjectContainer):
	def __init__(self):
		super(Sprite, self).__init__()

		self.graphics = Graphics()
		self.graphics.parent = self
		self.useHandCursor = False
		self.shapes = None
		self._clipPath = self.graphics._clipPath
		self._loopEventList = []

	def _loopDraw(self, c):
		self.graphics._show(c)

		stage._showDisplayList(self.childList)

	def _loopFrame(self, e):
		self.dispatchEvent(e)

	def startX(self):
		left = self.graphics.startX()

		for o in self.childList:
			sx = o.startX()

			if sx < left:
				left = sx
		
		return left + self.x

	def startY(self):
		top = self.graphics.startY()

		for o in self.childList:
			sy = o.startY()

			if sy < top:
				top = sy
		
		return top + self.y

	def endX(self):
		right = self.graphics.endX()

		for o in self.childList:
			ex = o.endX()

			if ex > right:
				right = ex
		
		return right + self.x

	def endY(self):
		bottom = self.graphics.endY()

		for o in self.childList:
			ey = o.endY()

			if ey > bottom:
				bottom = ey
		
		return bottom + self.y

	def __getVisualCoordinate(self, origin, obj):
		return {
			"x" : origin["x"] + obj.x * origin["scaleX"],
			"y" : origin["y"] + obj.y * origin["scaleY"],
			"scaleX" : origin["scaleX"] * obj.scaleX,
			"scaleY" : origin["scaleY"] * obj.scaleY
		}

	def _isMouseOn(self, e, cd):
		if not self.visible:
			return

		childList = self.childList[::-1]
		
		if not self._hasMask():
			for o in childList:
				childCd = self.__getVisualCoordinate(cd, o)

				if o._isMouseOn(e, childCd):
					o._mouseIsOn = True

					e["target"] = o

					return True
				else:
					o._mouseIsOn = False

			graphicsCd = self.__getVisualCoordinate(cd, self.graphics)

			if (self.graphics._isMouseOn(e, graphicsCd)):
				self.graphics._mouseIsOn = True

				e["target"] = self.graphics

				return True
			else:
				self.graphics._mouseIsOn = False
		else:
			return self.mask._isMouseOn(e, cd)

		return False

	def _enterMouseEvent(self, e, cd, hasBeenOn = False):
		if not self.visible:
			return

		currentCd = self.__getVisualCoordinate(cd, self)

		isOn = hasBeenOn

		if not hasBeenOn:
			isOn = self._isMouseOn(e, currentCd)

		if isOn:
			if self.useHandCursor:
				stage._useHandCursor = True

			if e["eventType"] == MouseEvent.MOUSE_MOVE.eventType and not self._mouseOver:
				self._mouseOver = True

				e["eventType"] = MouseEvent.MOUSE_OVER.eventType

				self.__dispatchMouseEvent(e, currentCd)

				e["eventType"] = MouseEvent.MOUSE_MOVE.eventType

			if self.mouseChildren:
				for o in self.childList[::-1]:
					if (hasattr(o, "_enterMouseEvent") and hasattr(o._enterMouseEvent, "__call__") and o._enterMouseEvent(e, currentCd, o._mouseIsOn)):
						if e["eventType"] != MouseEvent.MOUSE_MOVE.eventType:
							break
						
			self.__dispatchMouseEvent(e, currentCd)

			if self.mouseShelter:
				return True
			else:
				return False
		elif e["eventType"] == MouseEvent.MOUSE_MOVE.eventType and self._mouseOver:
			self._mouseOutEvent(e, cd)

		return False

	def _mouseOutEvent(self, e, cd):
		if not self.visible:
			return

		currentCd = self.__getVisualCoordinate(cd, self)

		stage._useHandCursor = False

		self._mouseOver = False

		if self.mouseChildren:
			for o in self.childList[::-1]:
				if (hasattr(o, "_mouseOutEvent") and hasattr(o._mouseOutEvent, "__call__") and o._mouseOutEvent(e, currentCd)):
					break

		e["eventType"] = MouseEvent.MOUSE_OUT.eventType

		self.__dispatchMouseEvent(e, currentCd)

		e["eventType"] = MouseEvent.MOUSE_MOVE.eventType

	def __dispatchMouseEvent(self, e, cd):
		if not self.mouseEnabled:
			return

		eve = Event(e["eventType"])
		eve.offsetX = e["offsetX"]
		eve.offsetY = e["offsetY"]
		eve.selfX = (e["offsetX"] - cd["x"]) / cd["scaleX"]
		eve.selfY = (e["offsetY"] - cd["y"]) / cd["scaleY"]
		eve.target = e["target"]
		eve.currentTarget = self
		self.dispatchEvent(eve)

	def _getOriginalWidth(self):
		return self.endX() - self.startX()

	def _getOriginalHeight(self):
		return self.endY() - self.startY()

	def addShape(self, sh):
		if not isinstance(self.shapes, list):
			self.shapes = []

		if isinstance(sh, Rectangle):
			sh = Polygon(sh)

		self.shapes.append(sh)

	def clearShapes(self):
		self.shapes = None

	def hitTestObject(self, obj):
		shListA = None
		shListB = None
		mA = self.getRootMatrix()
		mB = obj.getRootMatrix()

		if not isinstance(self.shapes, list):
			shListA = [Polygon(Rectangle(0, 0, self._getOriginalWidth(), self._getOriginalHeight()))]
		else:
			shListA = self.shapes

		if not isinstance(obj.shapes, list):
			shListB = [Polygon(Rectangle(0, 0, obj._getOriginalWidth(), obj._getOriginalHeight()))]
		else:
			shListB = obj.shapes

		for itm in shListA:
			shA = itm.getTransform(mA)

			for ite in shListB:
				shB = ite.getTransform(mB)

				if SAT.hitTest(shA, shB):
					return True

		return False
	
	def __isLoopEvent(self, e):
		e = Event(e)
		return e.eventType.find("loop_") == 0

	def addEventListener(self, e, listener):
		if self.__isLoopEvent(e):
			self._addEventListenerInList(e, listener, self._loopEventList)
		else:
			super(Sprite, self).addEventListener(e, listener)

	def removeEventListener(self, e, listener):
		if self.__isLoopEvent(e):
			self._removeEventListenerInList(e, listener, self._loopEventList)
		else:
			super(Sprite, self).removeEventListener(e, listener)

	def removeAllEventListeners(self):
		self._loopEventList = []

		super(Sprite, self).removeAllEventListeners()

	def dispatchEvent(self, e):
		if self.__isLoopEvent(e):
			self._dispatchEventInList(e, self._loopEventList)
		else:
			super(Sprite, self).dispatchEvent(e)

	def hasEventListener(self, e, listener):
		if self.__isLoopEvent(e):
			return self._hasEventListenerInList(e, listener, self._loopEventList)
		else:
			return super(Sprite, self).hasEventListener(e, listener) class BitmapData(Object):
	def __init__(self, image = QtGui.QImage(), x = 0, y = 0, width = 0, height = 0):
		super(BitmapData, self).__init__()

		if isinstance(image, QtGui.QImage):
			if stage.app:
				image = QtGui.QPixmap(image)
		elif not isinstance(image, QtGui.QPixmap):
			raise TypeError("BitmapData(image = QtGui.QImage(), x = 0, y = 0, width = 0, height = 0): parameter 'image' must be a QPixmap or QImage object.")

		self.image = image
		self.x = x
		self.y = y
		self.width = width
		self.height = height
		self.__locked = False
		self.__pixelData = []

		if image is not None:
			if width == 0:
				self.width = image.width()

			if height == 0:
				self.height = image.height()

	@property
	def x(self):
		return self.__x

	@x.setter
	def x(self, value):
		if value > self.image.width():
			value = self.image.width()
		
		self.__x = value

	@property
	def y(self):
		return self.__y

	@y.setter
	def y(self, value):
		if value > self.image.height():
			value = self.image.height()
		
		self.__y = value

	@property
	def width(self):
		return self.__width

	@width.setter
	def width(self, value):
		if (value + self.x) > self.image.width():
			value = self.image.width() - self.x
		
		self.__width = value

	@property
	def height(self):
		return self.__height

	@height.setter
	def height(self, value):
		if (value + self.y) > self.image.height():
			value = self.image.height() - self.y
		
		self.__height = value

	def setCoordinate(self, x = 0, y = 0):
		self.x = x
		self.y = y

	def setProperties(self, x = 0, y = 0, width = 0, height = 0):
		self.x = x
		self.y = y
		self.width = width
		self.height = height

	def draw(self, source):
		if not isinstance(source, DisplayObject):
			raise TypeError("BitmapData.draw(source): parameter 'source' must be a display object.")

		w = source.endX()
		h = source.endY()

		self.image = QtGui.QPixmap(w, h)
		self.image.fill(QtCore.Qt.transparent)
		
		p = QtGui.QPainter()
		p.begin(self.image)

		if stage.useAntialiasing:
			p.setRenderHint(QtGui.QPainter.Antialiasing, True)
		else:
			p.setRenderHint(QtGui.QPainter.Antialiasing, False)

		source._show(p)

		p.end()

		self.width = w
		self.height = h

	def __getPixelData(self):
		if isinstance(self.image, QtGui.QPixmap):
			self.image = self.image.toImage()

		for i in range(self.height):
			for j in range(self.width):
				self.__pixelData.append(self.image.pixel(j, i))

	def __updatePixelData(self):
		x = 0
		y = 0

		for i in range(len(self.__pixelData)):
			v = self.__pixelData[i]

			self.image.setPixel(x, y, v)

			x += 1

			if x >= self.width:
				x = 0
				y += 1

		self.image = QtGui.QPixmap(self.image)

		self.__pixelData = []

	def lock(self):
		if self.__locked:
			return

		self.__locked = True

		self.__getPixelData()

	def unlock(self):
		if not self.__locked:
			return

		self.__locked = False

		self.__updatePixelData()

	def getPixel(self, x, y):
		if not self.__locked:
			self.__getPixelData()

		i = math.floor(y * self.width + x)

		if i < 0 or i >= len(self.__pixelData):
			raise ValueError("BitmapData.getPixel(x, y): the point (x, y) is not in the image.")

		if not self.__locked:
			self.__updatePixelData()

		return self.__pixelData[i]

	def setPixel(self, x, y, color):
		if not self.__locked:
			self.__getPixelData()

		i = math.floor(y * self.width + x)

		if i < 0 or i >= len(self.__pixelData):
			raise ValueError("BitmapData.setPixel(x, y, color): the point (x, y) is not in the image.")

		if isinstance(color, int):
			color = str(color)

		self.__pixelData[i] = int(color, 16)

		if not self.__locked:
			self.__updatePixelData()

	def getPixels(self, rect):
		if not self.__locked:
			self.__getPixelData()

		result = []

		left = math.floor(rect.left)
		right = math.floor(rect.right)
		top = math.floor(rect.top)
		bottom = math.floor(rect.bottom)

		for y in range(top, bottom):
			for x in range(left, right):
				i = math.floor(y * self.width + x)

				if i < 0 or i >= len(self.__pixelData):
					raise ValueError("BitmapData.getPixels(rect): parameter 'rect' is not in the image.")

				result.append(self.__pixelData[i])

		if not self.__locked:
			self.__updatePixelData()

		return result

	def setPixels(self, rect, pixel):
		if not self.__locked:
			self.__getPixelData()

		pixelType = 0

		if isinstance(pixel, int):
			pixel = str(pixel)
		elif isinstance(pixel, list):
			if len(pixel) < rect.width * rect.height:
				raise TypeError("BitmapData.setPixels(rect, pixel): parameter 'pixel' doesn't have enough pixel data.")

			pixelType = 1
		elif not isinstance(pixel, str):
			raise TypeError("BitmapData.setPixels(rect, pixel): parameter 'pixel' must be str, int or list object.")

		left = math.floor(rect.left)
		right = math.floor(rect.right)
		top = math.floor(rect.top)
		bottom = math.floor(rect.bottom)

		for y in range(top, bottom):
			for x in range(left, right):
				i = math.floor(y * self.width + x)

				if i < 0 or i >= len(self.__pixelData):
					raise ValueError("BitmapData.setPixels(rect, pixel): parameter 'rect' is not in the image.")

				if pixelType == 0:
					self.__pixelData[i] = int(pixel, 16)
				else:
					j = math.floor((y - top) * rect.width + x - left)
					self.__pixelData[i] = pixel[j]

		if not self.__locked:
			self.__updatePixelData() class Bitmap(DisplayObject):
	def __init__(self, bitmapData = BitmapData()):
		super(Bitmap, self).__init__()

		self.bitmapData = bitmapData

	def _getOriginalWidth(self):
		return self.bitmapData.width

	def _getOriginalHeight(self):
		return self.bitmapData.height

	def _loopDraw(self, c):
		bmpd = self.bitmapData
		image = bmpd.image

		if isinstance(image, QtGui.QPixmap):
			c.drawPixmap(0, 0, image, bmpd.x, bmpd.y, bmpd.width, bmpd.height)
		elif isinstance(image, QtGui.QImage):
			c.drawImage(0, 0, image, bmpd.x, bmpd.y, bmpd.width, bmpd.height) class FPS(Sprite):
	def __init__(self):
		super(FPS, self).__init__()
		
		self.__count = 0
		self.__preTime = time.time()

		self.__background = Sprite()
		self.__background.alpha = 0.8
		self.addChild(self.__background)

		self.__txt = TextField()
		self.__txt.size = 20
		self.__txt.textColor = "white"
		self.addChild(self.__txt)

		self.addEventListener(LoopEvent.ENTER_FRAME, self.__onFrame)

	def __onFrame(self, e):
		currentTime = time.time()

		if currentTime - self.__preTime >= 1:
			self.__txt.text = str(self.__count)

			self.__background.graphics.clear()
			self.__background.graphics.beginFill("black")
			self.__background.graphics.drawRect(0, 0, self.__txt.width, self.__txt.height)
			self.__background.graphics.endFill()

			self.__count = 0

			self.__preTime = currentTime

			return

		self.__count += 1 class TextField(DisplayObject):
	def __init__(self):
		super(TextField, self).__init__()

		self.text = ""
		self.font = "Arial"
		self.size = 15
		self.textColor = "#000000"
		self.backgroundColor = None
		self.italic = False
		self.weight = TextFormatWeight.NORMAL
		self.textAlign = TextFormatAlign.LEFT
		self.textBaseline = TextFormatBaseline.TOP
		
	def _getOriginalWidth(self):
		font = self.__getFont()
		fontMetrics = QtGui.QFontMetrics(font)

		return fontMetrics.width(str(self.text))

	def _getOriginalHeight(self):
		font = self.__getFont()
		fontMetrics = QtGui.QFontMetrics(font)

		return fontMetrics.height()

	def __getFont(self):
		weight = self.weight

		if self.weight == TextFormatWeight.NORMAL:
			weight = QtGui.QFont.Normal
		elif self.weight == TextFormatWeight.BOLD:
			weight = QtGui.QFont.Bold
		elif self.weight == TextFormatWeight.BOLDER:
			weight = QtGui.QFont.Black
		elif self.weight == TextFormatWeight.LIGHTER:
			weight = QtGui.QFont.Light

		font = QtGui.QFont()
		font.setFamily(self.font)
		font.setPixelSize(self.size)
		font.setWeight(weight)
		font.setItalic(self.italic)

		return font

	def __getTextStartX(self):
		w = self._getOriginalWidth()

		if self.textAlign == TextFormatAlign.END or self.textAlign == TextFormatAlign.RIGHT:
			return -w
		elif self.textAlign == TextFormatAlign.CENTER:
			return -w / 2
		else:
			return 0

	def __getTextStartY(self):
		h = self._getOriginalHeight()

		if self.textBaseline == TextFormatBaseline.ALPHABETIC or self.textBaseline == TextFormatBaseline.MIDDLE:
			return -h
		elif self.textBaseline == TextFormatBaseline.MIDDLE:
			return -h / 2
		else:
			return 0

	def _loopDraw(self, c):
		font = self.__getFont()
		flags = QtCore.Qt.AlignCenter
		startX = self.__getTextStartX()
		startY = self.__getTextStartY()
		width = self._getOriginalWidth()
		height = self._getOriginalHeight()

		pen = QtGui.QPen()
		pen.setBrush(QtGui.QBrush(getColor(self.textColor)))

		if self.backgroundColor:
			brush = QtGui.QBrush()
			brush.setColor(getColor(self.backgroundColor))
			brush.setStyle(QtCore.Qt.SolidPattern)
			c.setBrush(brush)

			c.setPen(getColor("transparent"))

			c.drawRect(startX, startY, width, height)

		c.setFont(font)
		c.setPen(pen)
		c.drawText(startX, startY, width, height, flags, str(self.text)) class TextFormatWeight(object):
	NORMAL = "normal"
	BOLD = "bold"
	BOLDER = "bolder"
	LIGHTER = "lighter"

	def __init__(self):
		raise Exception("TextFormatWeight cannot be instantiated.") class MouseEvent(object):
	MOUSE_DOWN = Event("mouse_down")
	MOUSE_UP = Event("mouse_up")
	MOUSE_MOVE = Event("mouse_move")
	MOUSE_OVER = Event("mouse_over")
	MOUSE_OUT = Event("mouse_out")
	DOUBLE_CLICK = Event("mouse_dbclick")

	def __init__(self):
		raise Exception("MouseEvent cannot be instantiated.") class LoopEvent(object):
	ENTER_FRAME = Event("loop_enter_frame")
	EXIT_FRAME = Event("loop_exit_frame") class KeyboardEvent(object):
	KEY_DOWN = Event("key_down")
	KEY_UP = Event("key_up")

	def __init__(self):
		raise Exception("KeyboardEvent cannot be instantiated.") class LoadingSample1(LoadingSample):
	def __init__(self, **opt):
		bg = None

		if "background" in opt:
			bg = opt["background"]

		super(LoadingSample1, self).__init__(bg)
		
		if not "background" in opt:
			self.background.graphics.beginFill("black")
			self.background.graphics.drawRect(0, 0, stage.width, stage.height)
			self.background.graphics.endFill()

		if not "vacantColor" in opt:
			opt["vacantColor"] = "white"

		if not "numberWidth" in opt:
			opt["numberWidth"] = stage.width * 0.1

		if not "numberHeight" in opt:
			opt["numberHeight"] = opt["numberWidth"] / 0.6

		self.__blockWidth = opt["numberWidth"] / 3
		self.__blockHeight = opt["numberHeight"] / 5
		self.progressBarWidth = self.__blockHeight * 7.5
		self.progressBarTotalHeight = self.__blockHeight * 5

		if not "progressColor" in opt:
			opt["progressColor"] = RadialGradientColor(self.__blockWidth * 7.5, self.__blockHeight * 2.5, self.__blockWidth * 7.5)
			opt["progressColor"].addColorStop(0, "red")
			opt["progressColor"].addColorStop(0.3, "orange")
			opt["progressColor"].addColorStop(0.4, "yellow")
			opt["progressColor"].addColorStop(0.5, "green")
			opt["progressColor"].addColorStop(0.8, "blue")
			opt["progressColor"].addColorStop(1, "violet")

		self.progressColor = opt["progressColor"]
		self.vacantColor = opt["vacantColor"]

		self.progressBar.mask = Graphics()

		self.__numberList = [
			[
				[1, 1, 1],
				[1, 0, 1],
				[1, 0, 1],
				[1, 0, 1],
				[1, 1, 1]
			],
			[
				[1, 1, 0],
				[0, 1, 0],
				[0, 1, 0],
				[0, 1, 0],
				[1, 1, 1]
			],
			[
				[1, 1, 1],
				[0, 0, 1],
				[1, 1, 1],
				[1, 0, 0],
				[1, 1, 1]
			],
			[
				[1, 1, 1],
				[0, 0, 1],
				[1, 1, 1],
				[0, 0, 1],
				[1, 1, 1]
			],
			[
				[1, 0, 1],
				[1, 0, 1],
				[1, 1, 1],
				[0, 0, 1],
				[0, 0, 1]
			],
			[
				[1, 1, 1],
				[1, 0, 0],
				[1, 1, 1],
				[0, 0, 1],
				[1, 1, 1]
			],
			[
				[1, 1, 1],
				[1, 0, 0],
				[1, 1, 1],
				[1, 0, 1],
				[1, 1, 1]
			],
			[
				[1, 1, 1],
				[0, 0, 1],
				[0, 0, 1],
				[0, 0, 1],
				[0, 0, 1]
			],
			[
				[1, 1, 1],
				[1, 0, 1],
				[1, 1, 1],
				[1, 0, 1],
				[1, 1, 1]
			],
			[
				[1, 1, 1],
				[1, 0, 1],
				[1, 1, 1],
				[0, 0, 1],
				[1, 1, 1]
			]
		]

	def setProgress(self, value):
		ratio = value / 100
		totalHeight = self.progressBarTotalHeight
		right = 0
		startY = totalHeight * (1 - ratio)
		mask = self.progressBar.mask
		blockW = self.__blockWidth
		blockH = self.__blockHeight

		mask.clear()

		for i in str(round(value)):
			numArray = self.__numberList[int(i)]

			for y, row in enumerate(numArray):
				for x, elem in enumerate(row):
					if elem == 1:
						mask.beginFill()
						mask.drawRect(right + x * blockW, y * self.__blockHeight, blockW, self.__blockHeight)
						mask.endFill()

			right += blockW * 4

		mask.beginFill()
		mask.drawCircle(right + blockW / 2, blockW / 2, blockW / 2)
		right += blockW
		mask.moveTo(right + blockW, 0)
		mask.lineTo(right + blockW * 2, 0)
		mask.lineTo(right, blockH * 5)
		mask.lineTo(right - blockW, blockH * 5)
		right += blockW
		mask.drawCircle(right + blockW / 2, totalHeight - blockW / 2, blockW / 2)
		right += blockW
		mask.endFill()

		self.progressBar.graphics.clear()

		self.progressBar.graphics.beginFill(self.vacantColor)
		self.progressBar.graphics.drawRect(0, 0, right, totalHeight)
		self.progressBar.graphics.endFill()

		self.progressBar.graphics.beginFill(self.progressColor)
		self.progressBar.graphics.drawRect(0, startY, right, totalHeight - startY)
		self.progressBar.graphics.endFill()

		self.progressBar.x = (stage.width - right) / 2
		self.progressBar.y = (stage.height - totalHeight) / 2
import random
from Player import Player
from Item import Item
from pylash.core import stage, init, addChild, KeyCode
from pylash.loaders import LoadManage
from pylash.display import Sprite, BitmapData, Bitmap, FPS, TextField, TextFormatWeight
from pylash.events import MouseEvent, LoopEvent, KeyboardEvent
from pylash.ui import LoadingSample1
# !/usr/bin/env python3
# -*- coding: utf-8 -*-



dataList = {}

stageLayer = None
player = None
itemLayer = None
scoreTxt = None
addItemSpeed = 40
addItemSpeedIndex = 0
score = 0
keyboardEnabled = False

def main():
	# save the file paths which need to be loaded
	loadList = [
		{"name" : "player", "path" : "./images/player.png"},
		{"name" : "bg", "path" : "./images/bg.jpg"},
		{"name" : "item0", "path" : "./images/item0.png"},
		{"name" : "item1", "path" : "./images/item1.png"},
		{"name" : "item2", "path" : "./images/item2.png"},
		{"name" : "item3", "path" : "./images/item3.png"},
		{"name" : "item4", "path" : "./images/item4.png"},
		{"name" : "item5", "path" : "./images/item5.png"},
		{"name" : "item6", "path" : "./images/item6.png"},
		{"name" : "item7", "path" : "./images/item7.png"}
	]

	# create loading page
	loadingPage = LoadingSample1()
	addChild(loadingPage)

	def loadComplete(result):
		loadingPage.remove()

		gameInit(result)

	# load files
	LoadManage.load(loadList, loadingPage.setProgress, loadComplete)

def gameInit(result):
	global dataList, stageLayer

	dataList = result

	# create stage layer
	stageLayer = Sprite()
	addChild(stageLayer)

	# add FPS
	fps = FPS()
	addChild(fps)

	# add background

	bg = Bitmap(BitmapData(dataList["bg"]))