<commit_before>require "LovePunk.Tweener"

export ^

class Entity extends Tweener
	new: (x, y, graphic, mask) =>
		-- The bottommost position of the Entity's hitbox.
		@bottom = 0
		-- The center x position of the Entity's hitbox.
		@centerX = 0
		-- The center y position of the Entity's hitbox.
		@centerY = 0
		-- If the Entity should respond to collision checks.
		@collidable = false
		-- Graphical component to render to the screen.
		@graphic = nil
		-- Half the Entity's height.
		@halfHeight = 0
		-- Half the Entity's width.
		@halfWidth = 0
		-- Height of the Entity's hitbox.
		@height = 0
		-- The rendering layer of this Entity. Higher layers are rendered first.
		@layer = 0
		-- The leftmost position of the Entity's hitbox.
		@left = 0
		-- An optional Mask component, used for specialized collision. If this is not assigned, collision checks will use the Entity's hitbox by default.
		@mask = nil
		@name = ""
		-- If the Entity collides with the camera rectangle.
		@onCamera = false
		-- X origin of the Entity's hitbox.
		@originX = 0
		-- Y origin of the Entity's hitbox.
		@originY = 0
		-- The BitmapData target to draw the Entity to. Leave as nil to render to the current screen buffer (default).
		@renderTarget = nil
		-- The rightmost position of the Entity's hitbox.
		@right = 0
		-- The Scene object this Entity has been added to.
		@scene = nil
		-- The topmost position of the Entity's hitbox.
		@top = 0
		-- The collision type, used for collision checking.
		@type = ""
		-- If the Entity should render.
		@visible = false
		-- Width of the Entity's hitbox.
		@width = 0
		-- X position of the Entity in the Scene.
		@x = 0
		-- Y position of the Entity in the Scene.
		@y = 0

	-- The World object is deprecated for FlashPunk-like compatibility
	world: (value) =>
		@scene = value if value != nil
		@scene

	addGraphic: (g) =>
	added: =>
	centerGraphicInRect: =>
	centerOrigin: =>
	clampHorizontal: (left, right, padding) =>
	clampVertical: (top, bottom, padding) =>
	collide: (type, x, y) =>
	collideInto: (type, x, y, array) =>
	collidePoint: (x, y, pX, pY) =>
	collideRect: (x, y, rX, rY, rWidth, rHeight) =>
	collideTypes: (types, x, y) =>
	collideTypesInto: (types, x, y, array) =>
	collideWith: (e, x, y) =>
	distanceFrom: (e, useHitboxes) =>
	distanceToPoint: (px, py, useHitbox) =>
	distanceToRect: (rx, ry, rwidth, rheight) =>
	moveAtAngle: (angle, amount, solidType, sweep) =>
	moveBy: (x, y, solidType, sweep) =>
	moveCollideX: (e) =>
	moveCollideY: (e) =>
	moveTo: (x, y, solidType, sweep) =>
	moveTowards: (x, y, amount, solidType, sweep) =>
	removed: =>
	render: =>
	setHitbox: (width, height, originX, originY) =>
	setHitboxTo: (o) =>
	setOrigin: (x, y) =>
	toString: =>
	update: =><commit_msg>Arrange Entity as it is in HaxePunk<commit_after>require "LovePunk.LP"
require "LovePunk.Mask"
require "LovePunk.Tweener"

export ^

class Entity extends Tweener
	new: (x = 0, y = 0, graphic = nil, mask = nil) =>
		super!
		-- If the Entity should render.
		@visible = true
		-- If the Entity should respond to collision checks.
		@collidable = true
		-- If the entity should follow the camera.
		@followCamera = false
		-- X position of the Entity in the Scene.
		@__x = x
		-- Y position of the Entity in the Scene.
		@__y = y
		-- X origin of the Entity's hitbox.
		@originX = 0
		-- Y origin of the Entity's hitbox.
		@originY = 0
		-- Width of the Entity's hitbox.
		@width = 0
		-- Height of the Entity's hitbox.
		@height = 0

		-- The bottommost position of the Entity's hitbox.
		@bottom = 0
		-- The center x position of the Entity's hitbox.
		@centerX = 0
		-- The center y position of the Entity's hitbox.
		@centerY = 0
		@__moveX, @__moveY = 0, 0
		-- The collision type, used for collision checking.
		@type = ""
		@name = ""

		@__hitbox = Mask!
		@__point = LP.point
		@__camera = LP.point2

		-- The rendering layer of this Entity. Higher layers are rendered first.
		@layer = LP.BASELAYER!

		-- Graphical component to render to the screen.
		@graphic = graphic if graphic != nil

		-- An optional Mask component, used for specialized collision. If this is not assigned, collision checks will use the Entity's hitbox by default.
		@mask = mask if mask != nil

		@__hitbox\assignTo @

	x: (value) =>
		if value != nil
			@__x = value
			return @__x

		if @followCamera
			@__x + LP.camera.x
		else
			@__x

	y: (value) =>
		if value != nil
			@__y = value
			return @__y
		if @followCamera
			@__y + LP.camera.y
		else
			@__y

	-- The World object is deprecated for FlashPunk-like compatibility
	world: (value) =>
		@scene = value if value != nil
		@scene

	added: =>
	removed: =>
	update: =>
	render: =>
	collide: (type, x, y) =>
	collideTypes: (types, x, y) =>
	collideWith: (e, x, y) =>
	collideRect: (x, y, rX, rY, rWidth, rHeight) =>
	collidePoint: (x, y, pX, pY) =>
	collideInto: (type, x, y, array) =>
	collideTypesInto: (types, x, y, array) =>
	addGraphic: (g) =>
	setHitbox: (width, height, originX, originY) =>
	setHitboxTo: (o) =>
	setOrigin: (x, y) =>
	centerOrigin: =>
	distanceFrom: (e, useHitboxes) =>
	distanceToPoint: (px, py, useHitbox) =>
	distanceToRect: (rx, ry, rwidth, rheight) =>
	toString: =>
	moveBy: (x, y, solidType, sweep) =>
	moveTo: (x, y, solidType, sweep) =>
	moveTowards: (x, y, amount, solidType, sweep) =>
	moveAtAngle: (angle, amount, solidType, sweep) =>
	moveCollideX: (e) =>
	moveCollideY: (e) =>
	clampHorizontal: (left, right, padding) =>
	clampVertical: (top, bottom, padding) =>
	centerGraphicInRect: =>
{'fraction_non_alphanumeric': 0.13046634004717836, 'fraction_numerical': 0.004899292324442025, 'mean_word_length': 3.185269552012149, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 67, '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': '71977', 'n_tokens_mistral': 2102, 'n_tokens_neox': 1916, 'n_words': 706}