New answers tagged

0

When storing items of a child class in a vector, the vector will call the father's constructor (constructor of the type the vector was appointed to.) To avoid that, you'll want a vector of pointers instead: std::vector<DrawableEntity *> entites; For this approach you will likely have to dynamically allocate your entities manually using, say, the ...


1

The animations and logic for attacks can be broken down into individual logical units and then sequenced via data files. For example, you might have code like this: AdvanceBehavior(entity, target, speed) FallbackBehavior(entity, target, speed) SoundBehavior(entity, sound_id) AnimateBehavior(entity, anim_id, speed) and then you can have a data file that ...


1

Should I have a base class for the battler which has all the common methods and than inherent each character from that class with its own attack sequences? If you have a lot of battler types, I don't think you would necessarily want them all to be their separate class if they are very similar to each other otherwise. One approach would be to have them all ...


0

Turns out that I was using sfml 2.3.2 which I guess isn't fully compatible with qt creator so I tried sfml 2.0 and it suddenly worked. Here is a link to a video describing how to link SFML to Qt Creator: https://www.youtube.com/watch?v=VWvD4mUpyfU


1

Unfortunately, I don't have enough reputation to add a comment to your original post. Here is my go at a partial answer! Here is where you populate the top row with 30 white boxes. for (int i = 30 - 1; i != -1; i--) { hitbox[i][0] = 1; } It looks like your boxes are 20x20 because tmp[0].position = Vector2f(y * 20 - 10, x * 20 - 10); My honest ...


0

Switch statements are supposed to be surrounded by curly braces. switch(level.hitbox[y][x]) { case 1: tmp[0].position = Vector2f(y * 20 - 10, x * 20 - 10); tmp[1].position = Vector2f(y * 20 - 10, x * 20 + 10); tmp[2].position = Vector2f(y * 20 + 10, x * 20 + 10); tmp[3].position = Vector2f(y * 20 + 10, x * 20 - 10); ...



Top 50 recent answers are included