Skip to content
This repository has been archived by the owner on Feb 19, 2018. It is now read-only.

DCmC Main

Andrés edited this page Mar 17, 2015 · 8 revisions

This Documentation is from a code still under heavy development, you may find errors,sudden changes or the answer to life,universe and everything

###Overview Don't Crush my Castle main code implements the basic gameplay as a tower-defense game. Currently is more a test than final game, but it is intended to be playable

Example of DCmC gameplay
Example of DCmC gameplay
Name Version Implementation
DCmC 0.7.5 DCmC.cpp

Some global variables are defined on main to basic configuration of in-game options:

  • unsigned int fps_conf=60 defines frames per second
  • unsigned screen_width=600 width of windowed screen
  • unsigned screen_height=600 height of windowed screen
  • bool fullscreen=false if fullscreen is true, previous values will be overridden with current screen dimensions (currently unused)
  • string enemy_path="resources/spr/enemy_0/" path where enemy_0 (test) animations are

###Functions Some functions are defined to divide the game logic:

  • enemy_attributes create_enemy_0(const ALLEGRO_TIMER *timer) given main timer, return the [enemy attributes](Enemy Attributes) of the testing enemy (enemy_0)

  • tower_attributes create_tower_0(const ALLEGRO_TIMER *timer) given main timer, return the [tower attributes](Tower Attributes) of the testing tower (tower_0)

  • game spawner create_game_spawner() creates the testing spawner

  • void click_mouse(int button_number,unsigned int x,unsigned int y) function to be used as callback of [input handler](Input Handler), this function will be called when any mouse button is pressed

  • void key_pressed(int keycode) function to be used as callback of [input handler](Input Handler), this function will be called when any key is pressed

  • void game_over() will be called when player dies (callback of Player)

  • void game_win() will be called when player wins (callback of [Game Master](Game Master)) _Any call to game_over or game_win will prompt a message trough command line and will end the game

Also game_objects,game_map and another testing objects are defined in the main method

To see how to compile it, [Click Here](Getting Started)

DCmC Wiki 0.7.6

Clone this wiki locally