1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- THINGS TO LEARN:
- - is there a better way to implement kbhit()?
- - is there a way to flush the input stream at the beginning of every cycle? (at present player keeps moving even if keys are not pressed)
- ##################################################################################################
- IDEAS AND DOUBTS:
- - what if we gave int speed to every game_object?
- - what if position (and speed) was not an integer but a double? (we could cast it to int when we upload the matrix)
- - we could keep the same refreshing rate and change the speed of enemies and bullets instead...low refresh_rate makes it horrible to play
- - bomb_list still to be implemented...
- - if picture was a std::vector<std::vector<char>> we would not have to delete it!
- - why does box destroy things? it's not its job! destroy() should be independent
- - some methods, some data members should be made private or protected..maybe..
- - we could remove dead enemies from the list so that boss appears if enemies.empty()==true ( no need to use enemyalive() ) <- tried and re-tried with remove_if but just failed and re-failed...
- - box::draw() should not have arguments. everything it needs should be passed through box::refresh()
- - dead enemies should not move
- - box.draw() should be called when new positions have been evaluated and before bullets and bombs are killed. this way players
- can see when they're hit or hit something. we could draw an "*" where explosions take place
- - capitals should be allowed, it's really bad when you hit caps lock while playing and player stops moving...
- - toupper(command) and fflush(stdin) could be solutions to bugs 1 and 4
- - shots are not centered!! (because player is now 8 spaces long)
- - why is choose_level()'s variable "level" a char? why not just an integer?
- ##################################################################################################
- KNOWN BUGS:
- - keeping the same command pressed for some time makes it impossible to use commands for a while
- (maybe fflush() can solve this????)
- - box's boundaries shift left when several objects are drawn in the same spot
- -MADERNA DOES NOT BEHAVE CORRECTLY! There is a fatal bug when she spawns that makes all the boundaries to shift! (only the first line of the boss actually moves, the rest remains stuck)!
- ##################################################################################################
- PROBLEMS/BUGS FIXED IN V 4.1:
- - answering choose_level() with a character instead of a number makes it so that boss does not reset
- (every input should be checked!!) <- solved with a simple input check.
- - if caps lock is on, player cannot move (maybe toupper() can solve this???) <- solved with tolower().
- - really long nicknames can be entered <- solved with string::resize().
- - shootrate should increase as enemies die, otherwise there's very small chance that a single enemy will shoot. <- solved by substituting "rand()/RAND_MAX < shootrate" with "rand()/RAND_MAX < shootrate*ENEMY_NUM/n_alive_enemies", which grants that at every loop the amount of bullets shot remains constant and equal to shootrate*ENEMY_NUM.
- Here a brief explanation: if B is the amount of bombs we want the enemies to shoot per loop (and it is constant), B = p*n, where p is the probability of a single (alive) enemy to shoot a bomb and n is the number of living enemies. Since we want B to dipend from ENEMY_NUM (more enemies initially = more bombs are shot) B shall be also B = N*c, where N is ENEMY_NUM and c is a percentage (0<=c<=1); for example, if c=0.25, one quarter of the initial enemies will shoot at every loop. By imposing B=constant, p becomes N*c/n, therefore when n decreases (enemies die), p increases so that B remains the same (more than 1/4 of alive enemies will shoot, providing always B bombs per loop).
|