cocos_add_card_grid
Add a grid of interactive cards to Cocos Creator scenes for level selection, shop interfaces, or character pickers. Configure card appearance and wire click events for user interaction.
Instructions
Grid of tappable cards — level select, shop, character picker.
Each cards[i] is::
{"title": str,
"subtitle": str | None,
"icon_sprite_frame_uuid": str | None,
"variant": "primary" | "surface", # bg color, default "surface"
"click_events": [...] | None}Whole card is the button (tap anywhere). Title + subtitle auto- pick contrasting text colors for the chosen variant ("primary" variant gets bg-colored text; "surface" gets text-colored). Extras wrap to new rows when count > columns.
Returns {grid_node_id, cards: [{node_id, title_node_id,
subtitle_node_id, icon_node_id, button_component_id}, ...]}.
Wire per-card click by passing click_events in each spec.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| parent_node_id | Yes | ||
| cards | Yes | ||
| columns | No | ||
| card_width | No | ||
| card_height | No | ||
| spacing | No |