Class: Entity

me. Entity

new Entity(x, y, settings)

a Generic Object Entity
Parameters:
Name Type Description
x Number the x coordinates of the entity object
y Number the y coordinates of the entity object
settings Object Entity properties, to be defined through Tiled or when calling the entity constructor
Properties
Name Type Argument Description
width Number the physical width the entity takes up in game
height Number the physical height the entity takes up in game
name String <optional>
object entity name
id String <optional>
object unique IDs
image Image | String <optional>
resource name of a spritesheet to use for the entity renderable component
framewidth Number <optional>
width of a single frame in the given spritesheet
frameheight Number <optional>
height of a single frame in the given spritesheet
type String <optional>
object type
collisionMask Number <optional>
Mask collision detection for this object
shapes Object <optional>
the initial list of collision shapes (usually populated through Tiled)
Source:
entity.js, line 31

Extends

Classes

Error

Members

<static> alive :Boolean

dead/living state of the entity
default value : true
Type:
  • Boolean
Source:
entity.js, line 100

<static> body :me.Body

the entity body object
Type:
Source:
entity.js, line 110

<static> id :Number

object unique ID (as defined in Tiled)
Type:
  • Number
Source:
entity.js, line 91

<static> name :String

Entity name
as defined in the Tiled Object Properties
Type:
  • String
Source:
entity.js, line 72

<static> renderable :me.Renderable

The entity renderable component (can be any objects deriving from me.Renderable, like me.Sprite for example)
Type:
Source:
entity.js, line 37

<static> type :String

object type (as defined in Tiled)
Type:
  • String
Source:
entity.js, line 82

alpha :Number

Define the renderable opacity
Set to zero if you do not wish an object to be drawn
Type:
  • Number
Inherited From:
Default Value:
  • 1.0
Source:
renderable.js, line 151
See:
  • me.Renderable#setOpacity
  • me.Renderable#getOpacity

ancestor :me.Container

a reference to the Container object that contains this renderable, or undefined if it has not been added to one.
Type:
Inherited From:
Default Value:
  • undefined
Source:
renderable.js, line 163

Methods

<static> angleTo(entity) → {Number}

return the angle to the specified entity
Parameters:
Name Type Description
entity me.Entity Entity
Source:
entity.js, line 191
Returns:
angle in radians
Type
Number

<static> angleToPoint(vector) → {Number}

return the angle to the specified point
Parameters:
Name Type Description
vector me.Vector2d vector
Source:
entity.js, line 209
Returns:
angle in radians
Type
Number

<static> distanceTo(entity) → {Number}

return the distance to the specified entity
Parameters:
Name Type Description
entity me.Entity Entity
Source:
entity.js, line 156
Returns:
distance
Type
Number

<static> distanceToPoint(vector) → {Number}

return the distance to the specified point
Parameters:
Name Type Description
vector me.Vector2d vector
Source:
entity.js, line 174
Returns:
distance
Type
Number

<protected, static> draw(renderer)

object draw
not to be called by the end user
called by the game manager on each game loop
Parameters:
Name Type Description
renderer me.CanvasRenderer | me.WebGLRenderer a renderer object
Source:
entity.js, line 267

<private, static> onBodyUpdate()

update the bounds position when the body is modified
Source:
entity.js, line 250

<static> onCollision(response, other) → {Boolean}

onCollision callback
triggered in case of collision, when this entity body is being "touched" by another one
Parameters:
Name Type Description
response me.collision.ResponseObject the collision response object
other me.Entity the other entity touching this one (a reference to response.a or response.b)
Source:
entity.js, line 350
Returns:
true if the object should respond to the collision (its position and velocity will be corrected)
Type
Boolean

<static> onDeactivateEvent()

onDeactivateEvent Notification function
Called by engine before deleting the object
Source:
entity.js, line 337

<private, static> updateBounds()

update the bounds
Deprecated:
  • Yes
Source:
renderable.js, line 343

<private, static> updateBoundsPos()

update the bounds position when the position is modified
Source:
entity.js, line 234
Copyright © 2011 - 2017, Olivier Biot, Jason Oster, Aaron McLeod
Documentation generated by JSDoc 3.4.0 on 2017-02-28T11:37:40+08:00 using the DocStrap template modified by codename-.