Skip to content

PlayZone

A place on the table cards are played onto, with no code: drag a card from a Hand onto it (or click the card, then it) and it slides into place, laid out in a row or a pile. It takes only the kinds it Accepts, up to its Limit, from the hands named in From; a card it won’t take slides back to the hand. It lights up while a card it would take is held over it. Each card played sends its PlayMessage.

Part of the Cards module: Card games: cards (Card) drawn from decks (Deck) into hands (Hand) and played by dragging them onto play zones (PlayZone), shuffled, discarded and sliding between them; the Cards template, a duel against the computer made from a table of cards; and Create Deck, Create Play Zone and Create Card in the Entity menu.

Its Count and Played outputs are there for a Counter or a Text, and its Discard action (put every card on it on its discard pile: clearing the table at the end of a round) for a Trigger, a wire or a script. What’s on it and how many have been played are saved with the scene, so a rewind takes them back.

Works with: Hand (plays cards onto it); Card (the cards played on it, inside it)

Draws itself (its entity draws at Order 0 unless it has a Sprite, whose order counts).

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 card it takes (each a card’s Kind), separated by commas, e.g. “Creature, Spell”. Empty takes any. (Names card kinds: their names, separated by commas.) (Field: a name.)
  • limit: a whole number = 0. The most cards it holds: once it has this many it takes no more. 0 is no limit. (Field: a number.)
  • from: text = null. The hands that may play onto it, by name, separated by commas: each side’s own row. Empty: any hand. (Names entities: their names, separated by commas.) (Field: an entity’s name.)
  • faceUp: true or false = true. Turns the cards played onto it face up. Untick it to play cards face down: a trap, a hidden bet. (Field: on or off.)
  • layout: one of Row, Pile = “Row”. How it lays out the cards played onto it: in a CardLayout.Row or a CardLayout.Pile. (Field: one of its values.)
  • discardPile: text = null. The deck its Discard action puts its cards on, by name. Empty uses the scene’s first face-up deck. (Names an entity.) (Field: an entity’s name.)
  • discardAfter: a number = 0. Seconds a card played onto it stays once it has slid into place, before it goes on to its DiscardPile: a spell, cast and gone. Cards that stay on the table to do something (a creature, with a Health, or a card with a Card Effect that acts each turn) stay. 0 keeps every card until its Discard action. (Field: a number.)
  • size: [x, y] = [9,2.8]. How big it is, in world units: cards dropped inside it are played onto it. (Field: a vector.)
  • spacing: a number = 1.8. How far apart cards in a row are, middle to middle, while there’s room. (Field: a number.)
  • color: a color, “#RRGGBB” or “#RRGGBBAA” = “#FFFFFF18”. The color it’s drawn in on the table. Transparent draws nothing (it can lie over a picture of the table). (Field: a color.)
  • hoverColor: a color, “#RRGGBB” or “#RRGGBBAA” = “#FFE08260”. The color it lights up in while a card it would take is held over it, or the keys point at it. (Field: a color.)
  • label: text = null. Words written in it while it’s empty, e.g. “Play a card”. (Plain text: what’s written in it, its own words.) (Field: text.)
  • slideTime: a number = 0.25. Seconds a card takes to slide into place on it. (Field: a number.)
  • playSound: text = null. A sound played as a card is played onto it, e.g. “Sounds/play.wav”. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)
  • refuseSound: text = null. A sound played as it turns a card away. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)
  • playMessage: text = null. A message sent as a card is played onto it, with the card’s entity as its data. (Names a message.) (Field: a name.)
  • played: a whole number = 0. How many cards have been played onto it, all told. Saved with the scene, so a rewind takes them back. (Field: a number.)

What anything can make it do with no code: a Trigger’s do when its message arrives, a Contraptions Wire’s input as its signal comes on, a script’s Game.Do(entity, “Name”).

  • Discard. Puts every card on it on its discard pile at the start of the next frame.

What anything can read with no code: a Counter’s, Bar’s or Text’s output, a Contraptions Wire’s output as its signal; Text shows names too, the rest read numbers, true as 1.

  • Count (a whole number). How many cards are in it. Kept up to date by the game; in a network game, players’ machines are sent it.
  • Played (a whole number). How many cards have been played onto it, all told. Saved with the scene, so a rewind takes them back.

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

  • isFull: true or false. True while it holds its Limit.
  • count: a whole number. How many cards are in it. Kept up to date by the game; in a network game, players’ machines are sent it. (Sent in a network game.)

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