name: create-game-object description: How to create a new type of game object
Creating new game object types
- Review the circle game object as an example:
- Definition:
src/game/object.circle.ts - Draw:
src/canvas/draw.circle.ts
- Definition:
- Choose a name for the game object
- Add the name to the
GameObjectCategoryenum insrc/game/type.object.ts - Define the game object state by adding a new Zod type to
src/game/type.object.ts- Example:
export const ExampleState = GameObjectState.extend({...})
- Example:
- Create a new file at
src/game/object.example.tswith the game object class that extendsGameObject<ExampleState> - Create a new file at
src/canvas/draw.example.tswith adrawExamplefunction - Update the switch statement in the
drawObjectmethod in thesrc/canvas/draw.object.tsfile
Notes
Examplein the above steps is only an example name. The actual name should be based on the user instructions.- All of the abstract methods of
GameObjectneed implemented and should be functional based on the users instructions. - The draw method should be based on the user instructions.