Class: DollSlots

DollSlots()

Encapsulates the image slots a Doll might have

Constructor

new DollSlots()

Source:

Members

has_click_listeners :boolean

Whether any of the DollSlot object managed by this DollSlots has a click listener. Such a click listener is called if a the canvas used to draw a Doll is clicked and that click is within the rectangle of the listening DollSlot.
Type:
  • boolean
Source:

has_collision_listeners :boolean

Whether any of the DollSlot object managed by this DollSlots has a collision listener. Such a listener is called if the rectangle of a listening DollSlot intersects with another DollSlot in this DollSlots.
Type:
  • boolean
Source:

has_update_listeners :boolean

Whether any of the DollSlot object managed by this DollSlots has an update listener a timer is used to call such listeners periodically
Type:
  • boolean
Source:

items :Array

Array of DollSlot objects managed by this DollSlots.
Type:
  • Array
Source:

(nullable) parent :Doll

If not null, Doll on which this DollSlot lives.
Type:
Source:

Methods

get(DollSlot) → (nullable) {DollSlot}

Returns the DollSlot at index i if it exists else return null
Parameters:
Name Type Description
DollSlot int index to get
Source:
Returns:
the desired DollSlot if present
Type
DollSlot

init(parentnullable)

Calls init on each of the DollSlots in items. Initializes the has_click_listeners, has_collision_listeners, and has_update_listeners property based on checking for the corresponding listeners in each DollSlot iterated over.
Parameters:
Name Type Attributes Description
parent Doll <nullable>
Doll used to help initialize each Doll (used for Image loading (Doll needs to keep track of how many of its DollSlots still need to be loaded))
Source:

push(slot) → {boolean}

If the passed slot is a DollSlot adds it to items Array and returns true; otherwise, does nothing and returns false
Parameters:
Name Type Description
slot DollSlot to insert
Source:
Returns:
whether the item was added or not
Type
boolean

remove(index)

Removes and delete the DollSlot at location index from this DollSlots items array of DollSlot objects
Parameters:
Name Type Description
index int of DollSlot to remove
Source:

removeById(slot_id) → {boolean}

Removes the DollSlot of the given slot_id name from this DollSlots object
Parameters:
Name Type Description
slot_id string id property of the DollSlot to remove
Source:
Returns:
true if a DollSlot with the given id is found and removed, false otherwise
Type
boolean

set(i, slot) → {boolean}

If the passed slot is a DollSlot adds it to items Array at index i and return true; otherwise, does nothing and returns false
Parameters:
Name Type Description
i int index in items array to insert DollSlot
slot DollSlot to insert
Source:
Returns:
whether the item was added or not
Type
boolean