Guest User

Untitled

a guest
Oct 30th, 2023
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. ```Include <kirby.h> header:
  2.  
  3. #include <kirby.h>
  4. CreateWorld function
  5. void createWorld();
  6. Description
  7. Creates Kirby's world. The world description is read from the standart input.
  8.  
  9. Example
  10. #include <kirby.h>
  11.  
  12. int main(void) {
  13. createWorld();
  14. cleanWorld();
  15. return 0;
  16. }
  17. Compile with the following options:
  18.  
  19. gcc -o kirby kirby.c -ltps -lSDL2 -lSDL2_ttf
  20. Execute, providing a map in the standart entry
  21.  
  22. ./kirby < path/to/map.kirby-map
  23. CleanWorld function
  24. void cleanWorld();
  25. Description
  26. Cleans Kriby's world before the program exits. This function must be called before the program exits. After calling this function, Kirby's world no longer exists.
  27.  
  28. Function setSpeed
  29. void setSpeed(Uint32 t);
  30. Description
  31. Sets the speed of Kirby's actions, in milliseconds.
  32.  
  33. Parameters
  34. t is the speed in milliseconds
  35.  
  36. Function frontIsClear
  37. int frontIsClear();
  38. Description
  39. Returns true if Kirby can move forward
  40.  
  41. Function frontIsBlocked
  42. int frontIsBlocked();
  43. Description
  44. Returns true if Kirby cannot move forward
  45.  
  46. leftIsClear function
  47. int leftIsClear();
  48. Description
  49. Returns true if there is no wall on Kirby's left.
  50.  
  51. rightIsClear function
  52. int rightIsClear();
  53. Description
  54. Returns true if there is no wall on Kirby's right.
  55.  
  56. Function move
  57. void move();
  58. Description
  59. Moves Kirby one square forward.
  60.  
  61.  
  62. turnLeft function
  63. void turnLeft();
  64. Description
  65. Changes Kirby's orientation by turning it to the left. Kirby remains in the same position during this operation, only his orientation is changed. If he was looking up before this function was called, he will be looking to the left just after this function is called.
  66.  
  67. bagIsEmpty function
  68. int bagIsEmpty();
  69. Description
  70. Indicates whether Kirby's bag is empty.
  71.  
  72. isOnFruit function
  73. int isOnFruit();
  74. Description
  75. Returns true if Kirby is standing on a fruit (well, on a square that contains a fruit. If true, Kriby can pick up the fruit, so he's not really on it).
  76.  
  77. GetFruit function
  78. kb_fruit getFruit();
  79. Description
  80. Picks up fruit on the same square as Kirby
  81.  
  82. Kirby must be on a fruit, otherwise an error will occur.
  83.  
  84. see also isOnFruit
  85.  
  86. PutFruit function
  87. void putFruit();
  88. Description
  89. Places a piece of fruit on the same square as Kirby.
  90.  
  91. Kirby must have at least one piece of fruit in his bag, otherwise an error will occur.
  92.  
  93. Function topFruit
  94. kb_fruit topFruit();
  95. Description
  96. returns the first fruit in the bag (the last one put in the bag)
  97.  
  98. Kirby must have at least one piece of fruit in his bag, otherwise an error will occur.
  99.  
  100. isApple function
  101. int isApple(kb_fruit f);
  102. Description
  103. Indicates whether the given fruit is an apple
  104.  
  105. Function isBanana
  106. int isBanana(kb_fruit f);
  107. Description
  108. Indicates whether the given fruit is a banana```
Advertisement
Add Comment
Please, Sign In to add comment