<commit_before># Friday 2nd December 2016

from scene import *
import math
import random
import pickle

"""
todo (No order):
	- create joystick*
	- create player moved by joystick (and other physics)*
	- create walls*
	- create idling and walking animations*
	- create attack animations*
	- create health bar
	- create basic enemies
	- create doors~
	- add sound effects
	
* Completed
~ Partially completed
"""

BUTTON_COLOUR = '#000000' # Colour of buttons
BUTTON_ALPHA = 0.2 # Button transparency
JOYSTICK_AREA = 2 # Area where the joystick can spawn, the larger the number, the smaller the area
KNOB_RESTRICTION = 11 # How far the knob can move away from its origin
KNOB_DEADZONE = 20 # Create a deadzone so controls aren't too sensitive
TILE_SIZE = 64 # The size for tiles
MAX_SPEED = 5 # Max speed the player can go

ANIM_SPEED = 0.2 # Controls animation speed (higher = faster)


## Images
FLOOR = 'assets/floor.png'
WALL_SIDE = 'assets/wall_side.png'
WALL_CORNER = 'assets/wall_corner.png'
DOOR_CLOSED = 'assets/door_closed.png'
DOOR_OPEN = 'assets/door_open.png'

# Idle animations
PLAYER0_RIGHT_IDLE = ['assets/player0_right_idle0.png', 'assets/player0_right_idle1.png', 'assets/player0_right_idle2.png', 'assets/player0_right_idle3.png']
PLAYER0_UP_IDLE = ['assets/player0_up_idle0.png', 'assets/player0_up_idle1.png', 'assets/player0_up_idle2.png', 'assets/player0_up_idle3.png']
PLAYER0_DOWN_IDLE = ['assets/player0_down_idle0.png', 'assets/player0_down_idle1.png', 'assets/player0_down_idle2.png', 'assets/player0_down_idle3.png']

# Moving animations
PLAYER0_RIGHT_MOVE = ['assets/player0_right_move0.png', 'assets/player0_right_move1.png', 'assets/player0_right_move2.png', 'assets/player0_right_move3.png']
PLAYER0_UP_MOVE = ['assets/player0_up_move0.png', 'assets/player0_up_move1.png', 'assets/player0_up_move2.png', 'assets/player0_up_move3.png']
PLAYER0_DOWN_MOVE = ['assets/player0_down_move0.png', 'assets/player0_down_move1.png', 'assets/player0_down_move2.png', 'assets/player0_down_move3.png']

# Attacking animations
PLAYER0_RIGHT_ATTACK = [['assets/player0_right_attack0_var0.png'], ['assets/player0_right_attack0_var1.png']]
PLAYER0_UP_ATTACK = [['assets/player0_up_attack0_var0.png'], ['assets/player0_up_attack0_var1.png']]
PLAYER0_DOWN_ATTACK = [['assets/player0_down_attack0_var0.png'], ['assets/player0_down_attack0_var1.png']]

class DungeonGame (Scene):
	def setup(self):
		
		# Just playing around with pickling, left the code for future reference (saving game, etc.)
		'''
		store = ['Yo wattup', 3, (2, 4)]
		
		with open('dungeon.pickle', 'w') as file:
			pickle.dump(store, file)
		
		with open('dungeon.pickle', 'r') as file:
			store = pickle.load(file)
			print(store[2]) # >>> (2, 4
		'''
		
		# Player physics variables
		self.xVel = 0
		self.yVel = 0
		
		# Joystick origin variables
		self.x = 0
		self.y = 0
		
		# Movement
		self.xMove = 0
		self.yMove = 0
		
		# Animation
		self.animCounter = 0
		self.playerCooldown = 0.0
		self.playerAttackVar = 0.0
		
		# Player direction
		self.playerDirection = "side"
		
		# Decide if the player is attacking
		self.playerAttacking = False
		
		# The joystick isn't being used, so we tell the program to return a false boolean
		self.usingJoystick = False
		
		# Create enviroment
		self.draw_floor()
		self.draw_walls()
		self.draw_doors()
		
		# Create player
		self.player = SpriteNode(PLAYER0_RIGHT_IDLE[0])
		self.player.position = self.size.w / 2, self.size.h / 2
		self.add_child(self.player)
		
		# Shows the player's hitbox outline
		self.playerHitboxTest = SpriteNode(texture=('assets/outline.png'), anchor_point=(0,0), size=(TILE_SIZE, TILE_SIZE/2))
		self.add_child(self.playerHitboxTest)
		
		# Create the joystick base and knob
		self.joystickBase = SpriteNode(color=BUTTON_COLOUR, alpha=BUTTON_ALPHA, size=(self.size.h / 4, self.size.h / 4))
		self.joystickKnob = SpriteNode(color=BUTTON_COLOUR, alpha=BUTTON_ALPHA, size=(self.size.h / (4 * 4), self.size.h / (4 * 4)))
		
		'''
		# Create buttons
		self.buttonA = SpriteNode(color=BUTTON_COLOUR, alpha=BUTTON_ALPHA)
		self.buttonA.size = (self.size.h / 12, self.size.h / 12)
		self.buttonA.position = (self.size.w / 1.2, self.size.h / 5)
		self.add_child(self.buttonA)
		'''
	
	def update(self):
		self.player_physics()
		self.player_input()
		self.player_texture()
		
		# Updates player hitbox outline
		self.playerHitboxTest.position = (self.playerHitbox.x,self.playerHitbox.y)
		
		# If the joystick isn't being used, remove it
		if self.usingJoystick == False:
			self.joystickBase.remove_from_parent()
			self.joystickKnob.remove_from_parent()
			# Reset variables
			self.joystickKnob.position = (0, 0)
			self.x = 0
			self.y = 0
			
		# Reset player cooldown
		if self.playerCooldown > 0:
			self.playerAttacking = True
			self.playerCooldown -= 1
			
	def touch_began(self, touch):
		x, y = touch.location
			
		""" Add joytick """
		# Check if the user is touching within the bottom-left quadrant..
		if x < self.size.w / JOYSTICK_AREA and y < self.size.h / JOYSTICK_AREA:
			# Create a new variable to use the quadrant value
			self.x, self.y = x, y
			''' Create the joystick at the new position '''
			self.joystickBase.position = (self.x, self.y)
			self.add_child(self.joystickBase)
			self.joystickKnob.position = (self.x, self.y)
			self.add_child(self.joystickKnob)
			
			# Tell the program the joystick is being used
			self.usingJoystick = True
		
		# If a touch is detected elsewhere and self.playerCooldown <= 0 a player must be attacking
		elif self.playerCooldown <= 0:
			self.playerCooldown = 5
			self.playerAttackVar += 1
			
			if self.playerAttackVar > len(PLAYER0_RIGHT_ATTACK) - 1:
				self.playerAttackVar = 0
	
	def touch_moved(self, touch):
		x, y = touch.location
		
		""" Move joystick knob """
		# If the touched location is inside the bottom-left quadrant...
		if x < self.size.w / JOYSTICK_AREA and y < self.size.h / JOYSTICK_AREA:
			xMoved, yMoved = x, y # Only allows certain coordinates to pass
			
			''' if the touch has moved past the right side joystick base limit... '''
			if xMoved > self.x + self.size.h / KNOB_RESTRICTION:
				# Set the knob's x-coordinate to the right side joystick base limit
				knobX = self.x + self.size.h / KNOB_RESTRICTION
				''' else if the touch has moved past the left side joystick base limit... '''
			elif xMoved < self.x - self.size.h / KNOB_RESTRICTION:
				# Set the knob's x-coordinate to the left side joystick base limit
				knobX = self.x - self.size.h / KNOB_RESTRICTION
				''' else keep it where it is (which is inside the horizontal joystick base limits) '''
			else:
				knobX = xMoved
			
			''' if the touch has moved past the top joystick base limit... '''
			if yMoved > self.y + self.size.h / KNOB_RESTRICTION:
				# Set the knob's y-coordinate to the top joystick base limit
				knobY = self.y + self.size.h / KNOB_RESTRICTION
				''' if the touch has moved past the bottom joystick base limit... '''
			elif yMoved < self.y - self.size.h / KNOB_RESTRICTION:
				# Set the knob's y-coordinate to the bottom joystick base limit
				knobY = self.y - self.size.h / KNOB_RESTRICTION
				''' else keep it where it is (which is inside the vertical joystick base limits) '''
			else:
				knobY = yMoved
			
			# Set the joystick position to the previous calculations
			self.joystickKnob.position = (knobX, knobY)
				
	def touch_ended(self, touch):
		x, y = touch.location
		
		# If the player stops touching inside the left half of the screen, tell the program the joystick isn't being used
		# Used to later remove the joystick in 'remove_joystick(self)''
		if x < self.size.w / JOYSTICK_AREA and y < self.size.h:
			self.usingJoystick = False
			
	def draw_floor(self):
		# Create an empty Node to contain floor SpriteNodes
		self.floors = Node(parent=self)
		# Place floor
		for x in range(int(self.size.w / TILE_SIZE)):
			for y in range(int(self.size.h / TILE_SIZE)):
				floor = SpriteNode(texture=FLOOR, position=(x * TILE_SIZE + TILE_SIZE / 2, y * TILE_SIZE + TILE_SIZE / 2))
				self.floors.add_child(floor)
				y += 1
			x += 1
	
	def draw_walls(self):
		''' North wall '''
		# Create an empty Node to contain north wall SpriteNodes
		self.wallNorth = Node(parent=self)
		self.wallsNorth = []
		# Place north outer walls
		for x in range(int(self.size.w / TILE_SIZE)):
			wallSide = SpriteNode(texture=(WALL_SIDE))
			wallSide.rotation = 3.14
			wallSide.position = (TILE_SIZE * (x + 0.5), self.size.h - TILE_SIZE / 2)
			self.wallNorth.add_child(wallSide)
			self.wallsNorth.append(wallSide)
			x += 1
		
		''' South wall '''
		# Create an empty Node to contain south wall SpriteNodes
		self.wallSouth = Node(parent=self)
		# Place south walls
		for x in range(int(self.size.w / TILE_SIZE)):
			wallSide = SpriteNode(texture=(WALL_SIDE))
			wallSide.position = (TILE_SIZE * (x + 0.5), TILE_SIZE / 2)
			self.wallSouth.add_child(wallSide)
			x += 1
		
		''' East wall '''
		# Create an empty Node to contain east wall SpriteNodes
		self.wallEast = Node(parent=self)
		# Place east walls
		for y in range(int(self.size.h / TILE_SIZE)):
			wallSide = SpriteNode(texture=(WALL_SIDE))
			wallSide.rotation = 1.57
			wallSide.position = (self.size.w - TILE_SIZE / 2, TILE_SIZE * (y + 0.5))
			self.wallEast.add_child(wallSide)
			y += 1
		
		''' West wall '''
		# Create an empty Node to contain west wall SpriteNodes
		self.wallWest = Node(parent=self)
		# Place west walls
		for y in range(int(self.size.h / TILE_SIZE)):
			wallSide = SpriteNode(texture=(WALL_SIDE))
			wallSide.rotation = -1.57
			wallSide.position = (TILE_SIZE / 2, TILE_SIZE * (y + 0.5))
			self.wallWest.add_child(wallSide)
			y += 1
			
		''' Corner walls '''
		# Create an empty Node to contain corner wall SpriteNodes
		self.wallCorners = Node(parent=self)
		
		# Bottom-left corner
		wallCorner = SpriteNode(texture=WALL_CORNER)
		wallCorner.position = (TILE_SIZE / 2, TILE_SIZE / 2)
		self.wallCorners.add_child(wallCorner)
		
		# Bottom-right corner
		wallCorner = SpriteNode(texture=WALL_CORNER)
		wallCorner.position = (self.size.w - TILE_SIZE / 2, TILE_SIZE / 2)
		wallCorner.rotation = 1.57
		self.wallCorners.add_child(wallCorner)
		
		# Top-left corner
		wallCorner = SpriteNode(texture=WALL_CORNER)
		wallCorner.position = (TILE_SIZE / 2, self.size.h - TILE_SIZE / 2)
		wallCorner.rotation = 1.57
		self.wallCorners.add_child(wallCorner)
		
		# Top-right corner
		wallCorner = SpriteNode(texture=WALL_CORNER)
		wallCorner.position = (self.size.w - TILE_SIZE / 2, self.size.h - TILE_SIZE / 2)
		self.wallCorners.add_child(wallCorner)
	
	def draw_doors(self):
		self.doors = Node(parent=self)
		
		''' North doors '''
		# Left north door
		self.doorNorth1 = SpriteNode(texture=DOOR_CLOSED)
		self.doorNorth1.position = (TILE_SIZE * 7.5, self.size.h - TILE_SIZE / 2)
		self.doorNorth1.rotation = 3.14
		self.doorNorth1.x_scale = -1
		self.doors.add_child(self.doorNorth1)
		
		# Right north door
		self.doorNorth2 = SpriteNode(texture=DOOR_CLOSED)
		self.doorNorth2.position = (TILE_SIZE * 8.5, self.size.h - TILE_SIZE / 2)
		self.doorNorth2.rotation = 3.14
		self.doors.add_child(self.doorNorth2)
		
		''' South doors '''
		# Left south door
		self.doorSouth1 = SpriteNode(texture=DOOR_CLOSED)
		self.doorSouth1.position = (TILE_SIZE * (7.5), TILE_SIZE / 2)
		self.doors.add_child(self.doorSouth1)
		
		# Right south door
		self.doorSouth2 = SpriteNode(texture=DOOR_CLOSED)
		self.doorSouth2.position = (TILE_SIZE * (8.5), TILE_SIZE / 2)
		self.doorSouth2.x_scale = -1
		self.doors.add_child(self.doorSouth2)
		
		''' East doors '''
		# Left east door
		self.doorEast1 = SpriteNode(texture=DOOR_CLOSED)
		self.doorEast1.position = (self.size.w - TILE_SIZE / 2, TILE_SIZE * 5.5)
		self.doorEast1.rotation = 1.57
		self.doors.add_child(self.doorEast1)
		
		# Right east door
		self.doorEast2 = SpriteNode(texture=DOOR_CLOSED)
		self.doorEast2.position = (self.size.w - TILE_SIZE / 2, TILE_SIZE * 6.5)
		self.doorEast2.rotation = 1.57
		self.doorEast2.x_scale = -1
		self.doors.add_child(self.doorEast2)
		
		''' West doors '''
		# Left west door
		self.doorWest1 = SpriteNode(texture=DOOR_CLOSED)
		self.doorWest1.position = (TILE_SIZE / 2, TILE_SIZE * 5.5)
		self.doorWest1.rotation = -1.57
		self.doorWest1.x_scale = -1
		self.doors.add_child(self.doorWest1)
		
		# Right west door
		self.doorWest2 = SpriteNode(texture=DOOR_CLOSED)
		self.doorWest2.position = (TILE_SIZE / 2, TILE_SIZE * 6.5)
		self.doorWest2.rotation = -1.57
		self.doors.add_child(self.doorWest2)
		
	def player_physics(self):
		# Player pos
		self.player.position = (self.player.position.x + self.xVel, self.player.position.y + self.yVel)
		# Hitbox pos
		self.playerHitbox = Rect(self.player.position.x - self.player.size.w / 2, self.player.position.y - self.player.size.h / 2, TILE_SIZE, TILE_SIZE/2)
		
		
		# Set x movement limit	
		if self.xVel > MAX_SPEED:
			self.xVel = MAX_SPEED - self.playerCooldown
		
		elif self.xVel < -MAX_SPEED:
			self.xVel = -MAX_SPEED + self.playerCooldown
		
		
		# Set y movement limit
		if self.yVel > MAX_SPEED:
			self.yVel = MAX_SPEED - self.playerCooldown
		
		elif self.yVel < -MAX_SPEED:
			self.yVel = -MAX_SPEED + self.playerCooldown
			<commit_msg>Add static variable for rotation<commit_after># Friday 2nd December 2016

from scene import *
import math
import random
import pickle

"""
todo (No order):
	- create joystick*
	- create player moved by joystick (and other physics)*
	- create walls*
	- create idling and walking animations*
	- create attack animations*
	- create health bar
	- create basic enemies
	- create doors~
	- add sound effects
	
* Completed
~ Partially completed
"""

BUTTON_COLOUR = '#000000' # Colour of buttons
BUTTON_ALPHA = 0.2 # Button transparency
JOYSTICK_AREA = 2 # Area where the joystick can spawn, the larger the number, the smaller the area
KNOB_RESTRICTION = 11 # How far the knob can move away from its origin
KNOB_DEADZONE = 20 # Create a deadzone so controls aren't too sensitive
TILE_SIZE = 64 # The size for tiles
MAX_SPEED = 5 # Max speed the player can go

NORTH_ROTATION = 3.14
SOUTH_ROTATION = 0
EAST_ROTATION = 1.57
WEST_ROTATION = -EAST_ROTATION

ANIM_SPEED = 0.2 # Controls animation speed (higher = faster)


## Images
FLOOR = 'assets/floor.png'
WALL_SIDE = 'assets/wall_side.png'
WALL_CORNER = 'assets/wall_corner.png'
DOOR_CLOSED = 'assets/door_closed.png'
DOOR_OPEN = 'assets/door_open.png'

# Idle animations
PLAYER0_RIGHT_IDLE = ['assets/player0_right_idle0.png', 'assets/player0_right_idle1.png', 'assets/player0_right_idle2.png', 'assets/player0_right_idle3.png']
PLAYER0_UP_IDLE = ['assets/player0_up_idle0.png', 'assets/player0_up_idle1.png', 'assets/player0_up_idle2.png', 'assets/player0_up_idle3.png']
PLAYER0_DOWN_IDLE = ['assets/player0_down_idle0.png', 'assets/player0_down_idle1.png', 'assets/player0_down_idle2.png', 'assets/player0_down_idle3.png']

# Moving animations
PLAYER0_RIGHT_MOVE = ['assets/player0_right_move0.png', 'assets/player0_right_move1.png', 'assets/player0_right_move2.png', 'assets/player0_right_move3.png']
PLAYER0_UP_MOVE = ['assets/player0_up_move0.png', 'assets/player0_up_move1.png', 'assets/player0_up_move2.png', 'assets/player0_up_move3.png']
PLAYER0_DOWN_MOVE = ['assets/player0_down_move0.png', 'assets/player0_down_move1.png', 'assets/player0_down_move2.png', 'assets/player0_down_move3.png']

# Attacking animations
PLAYER0_RIGHT_ATTACK = [['assets/player0_right_attack0_var0.png'], ['assets/player0_right_attack0_var1.png']]
PLAYER0_UP_ATTACK = [['assets/player0_up_attack0_var0.png'], ['assets/player0_up_attack0_var1.png']]
PLAYER0_DOWN_ATTACK = [['assets/player0_down_attack0_var0.png'], ['assets/player0_down_attack0_var1.png']]

class DungeonGame (Scene):
	def setup(self):
		
		# Just playing around with pickling, left the code for future reference (saving game, etc.)
		'''
		store = ['Yo wattup', 3, (2, 4)]
		
		with open('dungeon.pickle', 'w') as file:
			pickle.dump(store, file)
		
		with open('dungeon.pickle', 'r') as file:
			store = pickle.load(file)
			print(store[2]) # >>> (2, 4
		'''
		
		# Player physics variables
		self.xVel = 0
		self.yVel = 0
		
		# Joystick origin variables
		self.x = 0
		self.y = 0
		
		# Movement
		self.xMove = 0
		self.yMove = 0
		
		# Animation
		self.animCounter = 0
		self.playerCooldown = 0.0
		self.playerAttackVar = 0.0
		
		# Player direction
		self.playerDirection = "side"
		
		# Decide if the player is attacking
		self.playerAttacking = False
		
		# The joystick isn't being used, so we tell the program to return a false boolean
		self.usingJoystick = False
		
		# Create enviroment
		self.draw_floor()
		self.draw_walls()
		self.draw_doors()
		
		# Create player
		self.player = SpriteNode(PLAYER0_RIGHT_IDLE[0])
		self.player.position = self.size.w / 2, self.size.h / 2
		self.add_child(self.player)
		
		# Shows the player's hitbox outline
		self.playerHitboxTest = SpriteNode(texture=('assets/outline.png'), anchor_point=(0,0), size=(TILE_SIZE, TILE_SIZE/2))
		self.add_child(self.playerHitboxTest)
		
		# Create the joystick base and knob
		self.joystickBase = SpriteNode(color=BUTTON_COLOUR, alpha=BUTTON_ALPHA, size=(self.size.h / 4, self.size.h / 4))
		self.joystickKnob = SpriteNode(color=BUTTON_COLOUR, alpha=BUTTON_ALPHA, size=(self.size.h / (4 * 4), self.size.h / (4 * 4)))
		
		'''
		# Create buttons
		self.buttonA = SpriteNode(color=BUTTON_COLOUR, alpha=BUTTON_ALPHA)
		self.buttonA.size = (self.size.h / 12, self.size.h / 12)
		self.buttonA.position = (self.size.w / 1.2, self.size.h / 5)
		self.add_child(self.buttonA)
		'''
	
	def update(self):
		self.player_physics()
		self.player_input()
		self.player_texture()
		
		# Updates player hitbox outline
		self.playerHitboxTest.position = (self.playerHitbox.x,self.playerHitbox.y)
		
		# If the joystick isn't being used, remove it
		if self.usingJoystick == False:
			self.joystickBase.remove_from_parent()
			self.joystickKnob.remove_from_parent()
			# Reset variables
			self.joystickKnob.position = (0, 0)
			self.x = 0
			self.y = 0
			
		# Reset player cooldown
		if self.playerCooldown > 0:
			self.playerAttacking = True
			self.playerCooldown -= 1
			
	def touch_began(self, touch):
		x, y = touch.location
			
		""" Add joytick """
		# Check if the user is touching within the bottom-left quadrant..
		if x < self.size.w / JOYSTICK_AREA and y < self.size.h / JOYSTICK_AREA:
			# Create a new variable to use the quadrant value
			self.x, self.y = x, y
			''' Create the joystick at the new position '''
			self.joystickBase.position = (self.x, self.y)
			self.add_child(self.joystickBase)
			self.joystickKnob.position = (self.x, self.y)
			self.add_child(self.joystickKnob)
			
			# Tell the program the joystick is being used
			self.usingJoystick = True
		
		# If a touch is detected elsewhere and self.playerCooldown <= 0 a player must be attacking
		elif self.playerCooldown <= 0:
			self.playerCooldown = 5
			self.playerAttackVar += 1
			
			if self.playerAttackVar > len(PLAYER0_RIGHT_ATTACK) - 1:
				self.playerAttackVar = 0
	
	def touch_moved(self, touch):
		x, y = touch.location
		
		""" Move joystick knob """
		# If the touched location is inside the bottom-left quadrant...
		if x < self.size.w / JOYSTICK_AREA and y < self.size.h / JOYSTICK_AREA:
			xMoved, yMoved = x, y # Only allows certain coordinates to pass
			
			''' if the touch has moved past the right side joystick base limit... '''
			if xMoved > self.x + self.size.h / KNOB_RESTRICTION:
				# Set the knob's x-coordinate to the right side joystick base limit
				knobX = self.x + self.size.h / KNOB_RESTRICTION
				''' else if the touch has moved past the left side joystick base limit... '''
			elif xMoved < self.x - self.size.h / KNOB_RESTRICTION:
				# Set the knob's x-coordinate to the left side joystick base limit
				knobX = self.x - self.size.h / KNOB_RESTRICTION
				''' else keep it where it is (which is inside the horizontal joystick base limits) '''
			else:
				knobX = xMoved
			
			''' if the touch has moved past the top joystick base limit... '''
			if yMoved > self.y + self.size.h / KNOB_RESTRICTION:
				# Set the knob's y-coordinate to the top joystick base limit
				knobY = self.y + self.size.h / KNOB_RESTRICTION
				''' if the touch has moved past the bottom joystick base limit... '''
			elif yMoved < self.y - self.size.h / KNOB_RESTRICTION:
				# Set the knob's y-coordinate to the bottom joystick base limit
				knobY = self.y - self.size.h / KNOB_RESTRICTION
				''' else keep it where it is (which is inside the vertical joystick base limits) '''
			else:
				knobY = yMoved
			
			# Set the joystick position to the previous calculations
			self.joystickKnob.position = (knobX, knobY)
				
	def touch_ended(self, touch):
		x, y = touch.location
		
		# If the player stops touching inside the left half of the screen, tell the program the joystick isn't being used
		# Used to later remove the joystick in 'remove_joystick(self)''
		if x < self.size.w / JOYSTICK_AREA and y < self.size.h:
			self.usingJoystick = False
			
	def draw_floor(self):
		# Create an empty Node to contain floor SpriteNodes
		self.floors = Node(parent=self)
		# Place floor
		for x in range(int(self.size.w / TILE_SIZE)):
			for y in range(int(self.size.h / TILE_SIZE)):
				floor = SpriteNode(texture=FLOOR, position=(x * TILE_SIZE + TILE_SIZE / 2, y * TILE_SIZE + TILE_SIZE / 2))
				self.floors.add_child(floor)
				y += 1
			x += 1
	
	def draw_walls(self):
		''' North wall '''
		# Create an empty Node to contain north wall SpriteNodes
		self.wallNorth = Node(parent=self)
		self.wallsNorth = []
		# Place north outer walls
		for x in range(int(self.size.w / TILE_SIZE)):
			wallSide = SpriteNode(texture=(WALL_SIDE))
			wallSide.rotation = NORTH_ROTATION
			wallSide.position = (TILE_SIZE * (x + 0.5), self.size.h - TILE_SIZE / 2)
			self.wallNorth.add_child(wallSide)
			self.wallsNorth.append(wallSide)
			x += 1
		
		''' South wall '''
		# Create an empty Node to contain south wall SpriteNodes
		self.wallSouth = Node(parent=self)
		# Place south walls
		for x in range(int(self.size.w / TILE_SIZE)):
			wallSide = SpriteNode(texture=(WALL_SIDE))
			wallSide.position = (TILE_SIZE * (x + 0.5), TILE_SIZE / 2)
			self.wallSouth.add_child(wallSide)
			x += 1
		
		''' East wall '''
		# Create an empty Node to contain east wall SpriteNodes
		self.wallEast = Node(parent=self)
		# Place east walls
		for y in range(int(self.size.h / TILE_SIZE)):
			wallSide = SpriteNode(texture=(WALL_SIDE))
			wallSide.rotation = EAST_ROTATION
			wallSide.position = (self.size.w - TILE_SIZE / 2, TILE_SIZE * (y + 0.5))
			self.wallEast.add_child(wallSide)
			y += 1
		
		''' West wall '''
		# Create an empty Node to contain west wall SpriteNodes
		self.wallWest = Node(parent=self)
		# Place west walls
		for y in range(int(self.size.h / TILE_SIZE)):
			wallSide = SpriteNode(texture=(WALL_SIDE))
			wallSide.rotation = WEST_ROTATION
			wallSide.position = (TILE_SIZE / 2, TILE_SIZE * (y + 0.5))
			self.wallWest.add_child(wallSide)
			y += 1
			
		''' Corner walls '''
		# Create an empty Node to contain corner wall SpriteNodes
		self.wallCorners = Node(parent=self)
		
		# Bottom-left corner
		wallCorner = SpriteNode(texture=WALL_CORNER)
		wallCorner.position = (TILE_SIZE / 2, TILE_SIZE / 2)
		self.wallCorners.add_child(wallCorner)
		
		# Bottom-right corner
		wallCorner = SpriteNode(texture=WALL_CORNER)
		wallCorner.position = (self.size.w - TILE_SIZE / 2, TILE_SIZE / 2)
		wallCorner.rotation = EAST_ROTATION
		self.wallCorners.add_child(wallCorner)
		
		# Top-left corner
		wallCorner = SpriteNode(texture=WALL_CORNER)
		wallCorner.position = (TILE_SIZE / 2, self.size.h - TILE_SIZE / 2)
		wallCorner.rotation = EAST_ROTATION
		self.wallCorners.add_child(wallCorner)
		
		# Top-right corner
		wallCorner = SpriteNode(texture=WALL_CORNER)
		wallCorner.position = (self.size.w - TILE_SIZE / 2, self.size.h - TILE_SIZE / 2)
		self.wallCorners.add_child(wallCorner)
	
	def draw_doors(self):
		self.doors = Node(parent=self)
		
		''' North doors '''
		# Left north door
		self.doorNorth1 = SpriteNode(texture=DOOR_CLOSED)
		self.doorNorth1.position = (TILE_SIZE * 7.5, self.size.h - TILE_SIZE / 2)
		self.doorNorth1.rotation = NORTH_ROTATION
		self.doorNorth1.x_scale = -1
		self.doors.add_child(self.doorNorth1)
		
		# Right north door
		self.doorNorth2 = SpriteNode(texture=DOOR_CLOSED)
		self.doorNorth2.position = (TILE_SIZE * 8.5, self.size.h - TILE_SIZE / 2)
		self.doorNorth2.rotation = NORTH_ROTATION
		self.doors.add_child(self.doorNorth2)
		
		''' South doors '''
		# Left south door
		self.doorSouth1 = SpriteNode(texture=DOOR_CLOSED)
		self.doorSouth1.position = (TILE_SIZE * (7.5), TILE_SIZE / 2)
		self.doors.add_child(self.doorSouth1)
		
		# Right south door
		self.doorSouth2 = SpriteNode(texture=DOOR_CLOSED)
		self.doorSouth2.position = (TILE_SIZE * (8.5), TILE_SIZE / 2)
		self.doorSouth2.x_scale = -1
		self.doors.add_child(self.doorSouth2)
		
		''' East doors '''
		# Left east door
		self.doorEast1 = SpriteNode(texture=DOOR_CLOSED)
		self.doorEast1.position = (self.size.w - TILE_SIZE / 2, TILE_SIZE * 5.5)
		self.doorEast1.rotation = EAST_ROTATION
		self.doors.add_child(self.doorEast1)
		
		# Right east door
		self.doorEast2 = SpriteNode(texture=DOOR_CLOSED)
		self.doorEast2.position = (self.size.w - TILE_SIZE / 2, TILE_SIZE * 6.5)
		self.doorEast2.rotation = EAST_ROTATION
		self.doorEast2.x_scale = -1
		self.doors.add_child(self.doorEast2)
		
		''' West doors '''
		# Left west door
		self.doorWest1 = SpriteNode(texture=DOOR_CLOSED)
		self.doorWest1.position = (TILE_SIZE / 2, TILE_SIZE * 5.5)
		self.doorWest1.rotation = WEST_ROTATION
		self.doorWest1.x_scale = -1
		self.doors.add_child(self.doorWest1)
		
		# Right west door
		self.doorWest2 = SpriteNode(texture=DOOR_CLOSED)
		self.doorWest2.position = (TILE_SIZE / 2, TILE_SIZE * 6.5)
		self.doorWest2.rotation = WEST_ROTATION
		self.doors.add_child(self.doorWest2)
		
	def player_physics(self):
		# Player pos
		self.player.position = (self.player.position.x + self.xVel, self.player.position.y + self.yVel)
		# Hitbox pos
		self.playerHitbox = Rect(self.player.position.x - self.player.size.w / 2, self.player.position.y - self.player.size.h / 2, TILE_SIZE, TILE_SIZE/2)
		
		
		# Set x movement limit	
		if self.xVel > MAX_SPEED:
			self.xVel = MAX_SPEED - self.playerCooldown
		
		elif self.xVel < -MAX_SPEED:
			self.xVel = -MAX_SPEED + self.playerCooldown
		
		
		# Set y movement limit
		if self.yVel > MAX_SPEED:
			self.yVel = MAX_SPEED - self.playerCooldown
		
		elif self.yVel < -MAX_SPEED:
			self.yVel = -MAX_SPEED + self.playerCooldown
			
{'fraction_non_alphanumeric': 0.11411941419451746, 'fraction_numerical': 0.019601952684941797, 'mean_word_length': 3.6306729264475743, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4480631', 'n_tokens_mistral': 11073, 'n_tokens_neox': 9599, 'n_words': 2284}