Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```Include <kirby.h> header:
- #include <kirby.h>
- CreateWorld function
- void createWorld();
- Description
- Creates Kirby's world. The world description is read from the standart input.
- Example
- #include <kirby.h>
- int main(void) {
- createWorld();
- cleanWorld();
- return 0;
- }
- Compile with the following options:
- gcc -o kirby kirby.c -ltps -lSDL2 -lSDL2_ttf
- Execute, providing a map in the standart entry
- ./kirby < path/to/map.kirby-map
- CleanWorld function
- void cleanWorld();
- Description
- 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.
- Function setSpeed
- void setSpeed(Uint32 t);
- Description
- Sets the speed of Kirby's actions, in milliseconds.
- Parameters
- t is the speed in milliseconds
- Function frontIsClear
- int frontIsClear();
- Description
- Returns true if Kirby can move forward
- Function frontIsBlocked
- int frontIsBlocked();
- Description
- Returns true if Kirby cannot move forward
- leftIsClear function
- int leftIsClear();
- Description
- Returns true if there is no wall on Kirby's left.
- rightIsClear function
- int rightIsClear();
- Description
- Returns true if there is no wall on Kirby's right.
- Function move
- void move();
- Description
- Moves Kirby one square forward.
- turnLeft function
- void turnLeft();
- Description
- 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.
- bagIsEmpty function
- int bagIsEmpty();
- Description
- Indicates whether Kirby's bag is empty.
- isOnFruit function
- int isOnFruit();
- Description
- 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).
- GetFruit function
- kb_fruit getFruit();
- Description
- Picks up fruit on the same square as Kirby
- Kirby must be on a fruit, otherwise an error will occur.
- see also isOnFruit
- PutFruit function
- void putFruit();
- Description
- Places a piece of fruit on the same square as Kirby.
- Kirby must have at least one piece of fruit in his bag, otherwise an error will occur.
- Function topFruit
- kb_fruit topFruit();
- Description
- returns the first fruit in the bag (the last one put in the bag)
- Kirby must have at least one piece of fruit in his bag, otherwise an error will occur.
- isApple function
- int isApple(kb_fruit f);
- Description
- Indicates whether the given fruit is an apple
- Function isBanana
- int isBanana(kb_fruit f);
- Description
- Indicates whether the given fruit is a banana```
Advertisement
Add Comment
Please, Sign In to add comment