Skip to content

Card

A playing card, with no code: it draws itself as a card of its Color with its Title along the top, its Value in the corner, a picture (Image) and its rules Text, or as its back while it’s face down. Put cards inside a Deck to draw from, a Hand to hold them or a PlayZone on the table: each lays out the cards inside it, and a card that goes from one to another slides over. Its Kind is what a play zone checks before it takes it.

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.

With a Sprite on it, the sprite is its face and the card only draws its back over it. Its back is the one of the deck it belongs to (its Home). Components on it that are an ICardPart hear when it’s drawn, played and discarded, and can say it can’t be played: that’s how card effects and costs hang off a card. With a TableValues its title, text, value, kind and color come from a row of a table (a deck made from a table gives each of its cards one). In a network game, a card in a face-down deck or in another side’s hidden hand isn’t sent to players who aren’t to see it.

Works with: TableValues (its title, text, value, kind and color from a row of a table)

Needed by: CardEffect

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

Changes how its entity is drawn (a tint, a shake or drawing it on top).

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.

  • title: text = null. What it’s called, written along its top. Empty writes its entity’s name. (Plain text: what’s written on it, its own words.) (Field: text.)
  • text: text = null. What it does, written under its picture and wrapped to fit, e.g. “Deal 3 damage.” (Plain text: what’s written on it, its own words.) (Field: text.)
  • value: a whole number = 0. A number in its top-left corner: its rank, its strength, its points. 0 shows none. A card with no picture and no text shows it big in its middle too, like a playing card. (Field: a number.)
  • kind: text = null. What kind of card it is, e.g. “Spell” or “Hearts”: a play zone’s Accepts names the kinds it takes. (Names a card kind: this entity’s own, which other fields can name.) (Field: a name.)
  • cost: a whole number = 0. Mana it costs to play, paid from the hand’s Mana (which refills as each of its team’s turns starts): a card that costs more than the hand has can’t be played. Shown in its top-right corner. 0 is free. (Field: a number.)
  • price: text = null. What else it costs to play, beside its mana: items, e.g. “2 Gold”, paid from the items of whoever plays it (an Inventory on the hand or the entity it’s inside, or its team’s: a strategy faction’s gold, coins a teammate picked up; see Items). A card whose price can’t be paid can’t be played. Empty costs nothing more. (Items and how many of each, separated by commas, e.g. “150 Gold, 50 Wood”. The Inspector lists them a row each, the item picked from the project’s and the count set.) (Field: its own editor: Counts.)
  • color: a color, “#RRGGBB” or “#RRGGBBAA” = “#F4EEE0FF”. The color of its face. (Field: a color.)
  • textColor: a color, “#RRGGBB” or “#RRGGBBAA” = “#2A2630FF”. The color of its writing. (Field: a color.)
  • image: text = null. A picture drawn on its face, e.g. “Art/fireball.png”. (A picture in Assets, e.g. “Sprites/back.png”.) (Field: an image.)
  • size: [x, y] = [1.6,2.24]. How big it is, in world units: 1.6 by 2.24 has a playing card’s shape. (Field: a vector.)
  • font: text = null. The font of its writing (see Text’s Font). Empty uses the built-in one. (Names a font.) (Field: a name.)
  • faceUp: true or false = true. True while its face shows. A deck turns the cards put in it face down (a face-up deck, such as a discard pile, face up), a hand face up and a play zone as its Face Up says. A hidden hand shows its faces only to its own side. (Field: on or off.)
  • home: text = null. The deck it belongs to, by name: its back is that deck’s, and the deck’s Restart gathers it back. Set by the game as it starts for the cards in each deck that have none. (Names an entity.) (Field: an entity’s name.)
  • playedBy: text = null. The hand it was last played from, by name: whose side it’s on while it’s on the table (its effects’ “you”, a creature’s side). Set by the game as it’s played. (Names an entity.) (Field: an entity’s name.)
  • onTableFor: a number = 0. Seconds it has lain in its place on a play zone with a Discard After, which goes on to the zone’s discard pile once it’s that long: a spell, cast and gone. Set by the game, and saved with the scene so a rewind keeps it. (Field: a number.)

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.

  • Value (a whole number). A number in its top-left corner: its rank, its strength, its points. 0 shows none. A card with no picture and no text shows it big in its middle too, like a playing card.
  • Cost (a whole number). Mana it costs to play, paid from the hand’s Mana (which refills as each of its team’s turns starts): a card that costs more than the hand has can’t be played. Shown in its top-right corner. 0 is free.

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

  • zone: an entity with a CardZone: its name, id or path. The place it’s in (the deck, hand or play zone it’s inside), or null.
  • isResting: true or false. True once it has slid into its place in its deck, hand or play zone.
  • shownTitle: text. The title it shows: Title, or its entity’s name.
  • shownText: text. The rules text it shows: its Text, or with none, what its CardEffects do.

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