How to use the CardEngine's demo
Why using the demo?
- You want to quickly evaluate that CardEngine is suitable for what you want to do.
- You need an example on how to use CardEngine.
The CardEngine's demo is quite simple to setup from any Godot project:
- Download and unzip it inside your Godot project
- Add "res://addons/card_engine/demo/interface.gd" in the AutoLoad project settings as a singleton named CEInterface
- Add "res://addons/card_engine/card_engine.gd" in the AutoLoad project settings as a singleton named CardEngine
- Add "res://addonst/card_engine/demo/game.gd" in the AutoLoad project settings as a singleton named DemoGame
- Activate the plugin in the project settings
- Create a new scene which inherit from "res://addons/card_engine/demo/main.tscn" and set it as the main scene in the project settings
- Run the project and you should arrive on the CardEngine Demo main menu screen
NOTE: CardEngine is only tested (and working) against the latest Godot version (3.0 at the time of writing).
The CardEngine demo covers a lot of ground and you will need some hint to properly explore it.
All the files for the demo resides inside the "res://addons/card_engine/demo/" folder:
- folder cards: contains the resources associated with the cards
- folder characters: contains the resources associated with the characters, player and enemy
- folder screens: contains the resources associated with the different screen which compose the game (main menu, new game, ...)
- folder widgets: contains the resources associated with reusable UI components
- file cards.json: the card database
- file custom_card.tscn: the custom card design scene
- file game.gd: the demo logic (singleton)
- file interface.gd: the interface between your code and CardEngine (singleton)
- file main.gd: logic for managing screens
- file main.tscn: scene for the screen management
- file master.svg: the game's vector graphics
The entry point
The demo start with the main.tscn, and the associated script main.gd. It is very simple, it only takes in charge loading the initial screen (main menu) and changing screen (on a signal).
The interface is a singleton (interface.gd) which contains the custom code needed by CardEngine to properly work inside your game. It contains functions which helps CardEngine to get insight from your project, like the database path, the custom card scene, how to compute numerical values, ...
The game logic
The game logic is implemented as a singleton (game.gd). It defines how a game happens and the different interactions possible.