Un runner fait en CSFML reprenant certaines mécaniques de jeu d'Orton and the princess.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #! /bin/bash
  2. # output file
  3. file_gcc="gcc.cfg"
  4. declare -A config
  5. config[FILE_DEBUG]=
  6. config[NO_WALL_MOVE]=
  7. config[VALGRIND]=
  8. config[WALL_SPEED]=5
  9. config[CAMERA_SPEED]=32
  10. config[FRAME_RATE]=64
  11. config[PLAYER_JUMP_MAX]=7
  12. config[PLAYER_SPEED]=6
  13. config[CAMERA_SHAKY]=15
  14. config[THROWER_STONE_SLEEP]=35
  15. config[THROWER_BULLET_SLEEP]=100
  16. config[BULLET_SPEED]=32
  17. config[NB_STONE]=64
  18. config[THROWER_DX_SLEEP]=4
  19. function help()
  20. {
  21. echo -e "Configuration script for my_runner."
  22. echo -e "\nOption that will print some debug log:"
  23. echo -e "\t\033[1;32m--file-debug [default: false]\033[0m"
  24. echo -e "\tEnable some indication when map file are loading."
  25. echo -e "\t\033[1;32m--valgrind-debug [default: false]\033[0m"
  26. echo -e "\tAdd some flags for debugging with valgrind."
  27. echo -e "\t\033[1;32m--help | -h\033[0m"
  28. echo -e "\tPrint this text."
  29. echo -e "\nOption that will affect the game:"
  30. echo -e "\t\033[1;32m--wall-speed=<interger> [default: 5]\033[0m"
  31. echo -e "\tAjuste wall speed."
  32. echo -e "\t\033[1;32m--camera-speed=<interger> [default: 32]\033[0m"
  33. echo -e "\tAjuste camera speed."
  34. echo -e "\t\033[1;32m--camera-shaky=<interger> [default: 15]\033[0m"
  35. echo -e "\tAjuste camera when player's dead."
  36. echo -e "\t\033[1;32m--player-jump-time=<interger> [default: 7]\033[0m"
  37. echo -e "\tAjuste player jump time."
  38. echo -e "\t\033[1;32m--frame-rate=<interger> [default: 64]\033[0m"
  39. echo -e "\tAjust frame rate."
  40. echo -e "\t\033[1;32m--stone-dx=<interger> [default: 4]\033[0m"
  41. echo -e "\tAjust X axis of thrower object."
  42. echo -e "\t\033[1;32m--stone-nb=<interger> [default:64]\033[0m"
  43. echo -e "\tAjust number of thrower object."
  44. echo -e "\t\033[1;32m--thrower-stone-sleep=<interger> [default: 35]\033[0m"
  45. echo -e "\tAjust the \"sleep\" of thrower. (stone)"
  46. echo -e "\t\033[1;32m--thrower-bullet-sleep=<interger> [default: 100]\033[0m"
  47. echo -e "\tAjust the \"sleep\" of thrower. (bullet)"
  48. echo -e "\t\033[1;32m--no-wall [default: false]\033[0m"
  49. echo -e "\tDisable moving wall."
  50. exit 0
  51. }
  52. function option_update()
  53. {
  54. if [[ "$1" -gt "0" ]]; then config[$2]=$1
  55. else errror; fi
  56. }
  57. function error()
  58. {
  59. echo -e "\033[1;33merror\033[0m need positive interger value."
  60. exit 1
  61. }
  62. function out_gcc()
  63. {
  64. if [ "${config[VALGRIND]}" != "" ]; then echo "-g3"
  65. else echo "-g0"; fi
  66. [ "${config[FILE_DEBUG]}" != "" ] && echo "-D DEBUG_LOAD_FILE"
  67. [ "${config[NO_WALL_MOVE]}" != "" ] && echo "-D NO_WALL_MOVE"
  68. echo "-D WALL_SPEED=${config[WALL_SPEED]}"
  69. echo "-D CAMERA_SPEED=${config[CAMERA_SPEED]}"
  70. echo "-D FRAME_RATE=${config[FRAME_RATE]}"
  71. echo "-D PLAYER_MAX_JUMP=${config[PLAYER_JUMP_MAX]}"
  72. echo "-D PLAYER_SPEED=${config[PLAYER_SPEED]}"
  73. echo "-D CAMERA_SHAKY=${config[CAMERA_SHAKY]}"
  74. echo "-D THROWER_STONE_SLEEP=${config[THROWER_STONE_SLEEP]}"
  75. echo "-D THROWER_BULLET_SLEEP=${config[THROWER_BULLET_SLEEP]}"
  76. echo "-D THROWER_DX_SLEEP=${config[THROWER_DX_SLEEP]}"
  77. echo "-D NB_OBJECT=${config[NB_STONE]}"
  78. }
  79. for arg; do case "$arg" in
  80. --help | -h) help;;
  81. --file-debug) config[FILE_DEBUG]=true;;
  82. --no-wall) config[NO_WALL_MOVE]=true;;
  83. --valgrind-debug) config[VALGRIND]=true;;
  84. --wall-speed=*) option_update ${arg#*=} WALL_SPEED;;
  85. --camera-speed=*) option_update ${arg#*=} CAMERA_SPEED;;
  86. --camera-shaky=*) option_update ${arg#*=} CAMERA_SHAKY;;
  87. --player-jump-time=*) option_update ${arg#*=} PLAYER_JUMP_MAX;;
  88. --player-speed=*) option_update ${arg#*=} PLAYER_SPEED;;
  89. --frame-rate=*) option_update ${arg#*=} FRAME_RATE;;
  90. --object-speed=*) option_update ${arg#*=} OBJECT_SPEED;;
  91. --thrower-stone-sleep=*) option_update ${arg#*=} THROWER_STONE_SLEEP;;
  92. --thrower-bullet-sleep=*) option_update ${arg#*=} THROWER_BULLET_SLEEP;;
  93. --stone-dx=*) option_update ${arg#*=} THROWER_DX_SLEEP;;
  94. --stone-nb=*) option_update ${arg#*=} NB_STONE;;
  95. *)
  96. echo -e "\033[1;33merror\033[0m unreconized argument '$arg'"
  97. exit 1
  98. esac; done
  99. echo "Configuration saved in $file_gcc."
  100. out_gcc > $file_gcc
  101. cat $file_gcc
  102. exit 0