-
Notifications
You must be signed in to change notification settings - Fork 1
How to Spawn Cards in a Room
This implementation includes
exported variablesthat is very useful for templating.
- Spawn it directly from the Room Editor (manual placement) (drag and drop)
- Spawn it through GML code (runtime creation)
-
Use drag & drop when:
-
You want a specific card permanently in a specific room.
-
You are designing static UI / scenes.
-
You want a quick visual setup and minimal code.
-
-
Use GML spawning when:
-
Cards change often (drawing, discarding, shuffling, effects).
-
You need scaling/positioning to adapt to screen size or layout.
-
You’re using IDs from JSON and building everything from data.
-
You want reusable UI elements that show “whatever card is selected right now.”
-
-
Use a mix when:
-
You drop a “container” object in the room (like a hand area or card slot),
-
Then have that object spawn displayCard instances in Create/Step event.
-
-
Both methods use the same
displayCardobject with additional steps. (located in./CardPage_obj/displayCard/) -
Spawning a card requires filling out
exported variables.
Just drag and drop

- When you run the game, it will always show a back of a card by default since we haven't specified which one we want it to show.
- In order to make it show a specific card:
- You will see that there are a couple exported variables:
- Edit
1to change the card to a specific one using the id of that card. See IDs in./datafiles/sample.json - Edit
2if you want the card's details to be drawn - Edit
3if you need to show it in a specific size (default at 100% or 1)- remember you won't see it changing the size in the editor, in the editor you will still see it as the default size (100% or 1), so you will need to change the size in the editor as well so it will be matched what you see in the editor and what it's actually rendered.
example of changing the size (Editing 3):
- all of these need to match
- you need to adjust where it will be spawned by editing
xandy. - again
1,2, and3are just the same as the drag and drop, since the object is still the same. - just need to be careful with
4, make sure that this name of an instances layer in the room existing.
After the code is executed the card will appear in the room.
Wiki
User Stories
Design
Requirements
Architecture
Considerations & Issues
Documentation
- How to Add a Card to the Game
- How the Music Controller & Script work
- Card Paging & Search System (CardManager)
- How to Spawn Cards in a Room
- How the Chessboard works
- How to Add a New Board Color
- How to use Alert System
- Chess Logic
- Cheat Mode
- Timer
- How the new card system works
- How the NEW Chessboard works