31
SFML projects / Re: Flappy-Bird Clone Attempt
« on: January 24, 2018, 10:14:13 pm »
Just skipped through it a bit, looks interesting.
But just some tiny hint I immediately noticed for your code – and since you're asking:
If you want to convert a single digit number to a character representing that digit, you can just add it to '0'.
Basically this:
You should try to properly indent your code so it becomes more readable.
Since you're doing a classic entity based design, you should put the logic into your entities. For example,
add the bird controls into the Bird class.
But just some tiny hint I immediately noticed for your code – and since you're asking:
If you want to convert a single digit number to a character representing that digit, you can just add it to '0'.
Basically this:
Code: [Select]
int digit1 = 5;
int digit2 = 9;
char char1 = '0' + digit1; // this is now '5'
char char2 = '0' + digit2; // this is now '9'
You should try to properly indent your code so it becomes more readable.
Since you're doing a classic entity based design, you should put the logic into your entities. For example,
add the bird controls into the Bird class.