Skip to content

DropTarget

A place to drop Draggable things: a slot in an inventory, a card’s place on the table, a hole a puzzle piece fits, a bin. Something dropped on it that it Accepts lands in its middle, until it holds Capacity things. It lights up with HoverTint while something it would take is held over it.

Its shape is its collider’s, or its sprite’s if it has no collider. What rests with its middle inside that shape is on it, however it got there: dropped, placed there in the editor, or moved by a script.

Works with: Draggable (things to drop on it)

Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.

  • accepts: text = null. The kinds of thing it takes (each a draggable’s Kind), separated by commas, e.g. “Red Gem, Blue Gem”. Empty takes anything. (Names draggable kinds: their names, separated by commas.) (Field: a name.)
  • capacity: a whole number = 1. How many things it holds at once; more are turned away. 0 holds any number: a bin, a discard pile. (Field: a number.)
  • snap: true or false = true. True if things dropped on it move to its middle. Off, they stay where they’re let go on it: a play area. (Field: on or off.)
  • swap: true or false = false. True if dropping something on it while it’s full swaps them: what was on it goes where the dropped thing came from, as in an inventory. Only with a Capacity of 1. (Field: on or off.)
  • hoverTint: a color, “#RRGGBB” or “#RRGGBBAA” = “#FFE082FF”. The color its sprite turns while something it would take is held over it. Transparent leaves it alone. (Field: a color.)
  • dropMessage: text = null. A message sent with Game.Send when something lands on it, with this entity as its data. (Names a message.) (Field: a name.)
  • takeMessage: text = null. A message sent with Game.Send when something is taken off it, with this entity as its data. (Names a message.) (Field: a name.)
  • allFullMessage: text = null. A message sent once every drop target with this same All Full Message is full (holds its Capacity, or something for a Capacity of 0), with this entity as its data: every piece in place, the puzzle solved. It’s sent again if they fill up again after one is emptied. (Names a message.) (Field: a name.)

Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.

  • isFull: true or false. True when it holds its Capacity (or, with a Capacity of 0, anything at all).

Scripts use it as DropTarget: its methods, events and values that aren’t saved with the scene.