-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_map_set.c
40 lines (37 loc) · 1.29 KB
/
game_map_set.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
** EPITECH PROJECT, 2018
** set
** File description:
** defender game set
*/
#include "include/my.h"
void game_road_set(game_t *game)
{
game->game_road->nbb = 0;
game->game_road->nbr = 0;
game->game_road->road_text = sfTexture_createFromFile
("sprite/road.png", NULL);
game->game_road->road_sprite = malloc(sizeof(sfSprite*) *
(my_count(game->map, '1', 19, 36)));
game->game_road->road_rect = malloc(sizeof(sfFloatRect) *
(my_count(game->map, '1', 19, 36)));
for (int i = 0; i != (my_count(game->map, '1', 19, 36)); i++) {
game->game_road->road_sprite[i] = sfSprite_create();
sfSprite_setTexture(game->game_road->road_sprite[i],
game->game_road->road_text, sfTrue);
}
}
void game_back_set(game_t *game)
{
game->game_back->back_text = sfTexture_createFromFile
("sprite/background.png", NULL);
game->game_back->back_sprite = malloc(sizeof(sfSprite*) *
(my_count(game->map, '0', 19, 36)));
game->game_back->back_rect = malloc(sizeof(sfFloatRect) *
(my_count(game->map, '0', 19, 36)));
for (int i = 0; i != (my_count(game->map, '0', 19, 36)); i++) {
game->game_back->back_sprite[i] = sfSprite_create();
sfSprite_setTexture(game->game_back->back_sprite[i],
game->game_back->back_text, sfTrue);
}
}