Search Results

Search found 1 results on 1 pages for 'madmax1'.

Page 1/1 | 1 

  • Moving characters on a grid [on hold]

    - by madmax1
    i am developing my first game with C++. My game uses a grid of rectangles. I have a class Board which manages the grid as a whole, initializes the terrain, places/removes characters, etc. It has a 2D vector of a class Field, which handles the Structure of the field, contained Objects, Characters, etc. Field again contains a vector of class Character, which are positioned on the field. Now i want to implement the functionality to move a character on the board, however dont know which is best practice to do so. Should i implement a moveCharacter(character, offset) function in Board, make it search for the character and move it? Or should i implement a function move(offset) in Character? This sure would be nicest, however makes characters necessary to know the board they are on, or the field which in turn knows the board. On the one hand i feel like i should avoid inclusion between classes as much as possible e.g. to increase portability of classes for different projects, on the other hand i think the character.move() functionality is most comfortable for further development. Im pretty new to "bigger" C++ projects and these kind of design questions pop up more and more often lately and i have troubles deciding. Thanks a lot for any advice!

    Read the article

1