The Table Engine
GameObjectFactory Class Reference

Factory for constructing different types of game objects. More...

#include <gameobjectfactory.h>

+ Collaboration diagram for GameObjectFactory:

Static Public Member Functions

static GameObjectcreatePlayerTest ()
 Creates a test player object. More...
 
static GameObjectcreateBow ()
 Creates a bow object. More...
 
static GameObjectcreateArrow (int dx, int dy)
 Creates an arrow object with specified dynamics. More...
 
static GameObjectcreateEnemyWarrior ()
 Creates an enemy warrior object. More...
 
static GameObjectcreateEnemyWarriorCustom (std::string path, int row, int col, float animationTime, int pos_x, int pos_y, int size_x, int size_y)
 Creates a customized enemy warrior object with specific texture and animations. More...
 
static GameObjectcreateTile1 ()
 Creates a basic tile object. More...
 
static GameObjectcreateTileCustom (std::string path, Vec2 pos, Vec2 size, Vec2 sprite_size, Vec2 sprite_pos, Vec2 rc)
 Creates a customized tile object with specific texture. More...
 
static GameObjectcreateWallCustom (std::string path, Vec2 pos, Vec2 size, Vec2 sprite_size, Vec2 sprite_pos)
 Creates a customized wall object with specific texture. More...
 
static GameObjectcreateTableCustom (std::string path, Vec2 pos, Vec2 size, Vec2 sprite_size, Vec2 sprite_pos)
 Creates a customized table object with specific texture. More...
 
static GameObjectcreateKey ()
 Creates a key object. More...
 
static GameObjectcreateCrosshair ()
 Creates a crosshair object. More...
 

Detailed Description

Factory for constructing different types of game objects.

GameObjectFactory provides a set of static methods that initialize game objects, setting them up with initial configurations and returning them for use in the game.

Definition at line 21 of file gameobjectfactory.h.

Member Function Documentation

◆ createArrow()

GameObject * GameObjectFactory::createArrow ( int  dx,
int  dy 
)
static

Creates an arrow object with specified dynamics.

Parameters
dxThe change in the arrow's x-position per update.
dyThe change in the arrow's y-position per update.
Returns
GameObject* Pointer to the newly created arrow object.

Definition at line 97 of file gameobjectfactory.cpp.

◆ createBow()

GameObject * GameObjectFactory::createBow ( )
static

Creates a bow object.

Returns
GameObject* Pointer to the newly created bow object.

Definition at line 66 of file gameobjectfactory.cpp.

◆ createCrosshair()

GameObject * GameObjectFactory::createCrosshair ( )
static

Creates a crosshair object.

Returns
GameObject* Pointer to the newly created crosshair object.

Definition at line 296 of file gameobjectfactory.cpp.

◆ createEnemyWarrior()

GameObject * GameObjectFactory::createEnemyWarrior ( )
static

Creates an enemy warrior object.

Returns
GameObject* Pointer to the newly created enemy warrior object.

Definition at line 128 of file gameobjectfactory.cpp.

◆ createEnemyWarriorCustom()

GameObject * GameObjectFactory::createEnemyWarriorCustom ( std::string  path,
int  row,
int  col,
float  animationTime,
int  pos_x,
int  pos_y,
int  size_x,
int  size_y 
)
static

Creates a customized enemy warrior object with specific texture and animations.

Parameters
pathTexture file path.
rowNumber of rows in the sprite sheet.
colNumber of columns in the sprite sheet.
animationTimeDuration of each animation frame.
pos_xInitial x-position of the enemy.
pos_yInitial y-position of the enemy.
size_xWidth of the enemy in the game world.
size_yHeight of the enemy in the game world.
Returns
GameObject* Pointer to the newly created customized enemy warrior.

Definition at line 160 of file gameobjectfactory.cpp.

◆ createKey()

GameObject * GameObjectFactory::createKey ( )
static

Creates a key object.

Returns
GameObject* Pointer to the newly created key object.

Definition at line 275 of file gameobjectfactory.cpp.

◆ createPlayerTest()

GameObject * GameObjectFactory::createPlayerTest ( )
static

Creates a test player object.

Returns
GameObject* Pointer to the newly created player object.

Definition at line 20 of file gameobjectfactory.cpp.

◆ createTableCustom()

GameObject * GameObjectFactory::createTableCustom ( std::string  path,
Vec2  pos,
Vec2  size,
Vec2  sprite_size,
Vec2  sprite_pos 
)
static

Creates a customized table object with specific texture.

Parameters
pathTexture file path.
posPosition of the table in the game world.
sizeSize of the table.
sprite_sizeSize of the table on the sprite sheet.
sprite_posPosition of the table on the sprite sheet.
Returns
GameObject* Pointer to the newly created customized table.

Definition at line 251 of file gameobjectfactory.cpp.

◆ createTile1()

GameObject * GameObjectFactory::createTile1 ( )
static

Creates a basic tile object.

Returns
GameObject* Pointer to the newly created tile object.

Definition at line 193 of file gameobjectfactory.cpp.

◆ createTileCustom()

GameObject * GameObjectFactory::createTileCustom ( std::string  path,
Vec2  pos,
Vec2  size,
Vec2  sprite_size,
Vec2  sprite_pos,
Vec2  rc 
)
static

Creates a customized tile object with specific texture.

Parameters
pathTexture file path.
posPosition of the tile in the game world.
sizeSize of the tile.
sprite_sizeSize of the tile on the sprite sheet.
sprite_posPosition of the tile on the sprite sheet.
Returns
GameObject* Pointer to the newly created customized tile.

Definition at line 209 of file gameobjectfactory.cpp.

◆ createWallCustom()

GameObject * GameObjectFactory::createWallCustom ( std::string  path,
Vec2  pos,
Vec2  size,
Vec2  sprite_size,
Vec2  sprite_pos 
)
static

Creates a customized wall object with specific texture.

Parameters
pathTexture file path.
posPosition of the wall in the game world.
sizeSize of the wall.
sprite_sizeSize of the wall on the sprite sheet.
sprite_posPosition of the wall on the sprite sheet.
Returns
GameObject* Pointer to the newly created customized wall.

Definition at line 228 of file gameobjectfactory.cpp.


The documentation for this class was generated from the following files: