Skip to content
This repository was archived by the owner on Oct 9, 2023. It is now read-only.

Commit 8a4795a

Browse files
authored
fixed missing enemy.h (#52)
2 parents a2cc949 + 7d3f5d1 commit 8a4795a

File tree

2 files changed

+30
-46
lines changed
  • enigme finale (another copy)/enigme finale (another copy)
  • include

2 files changed

+30
-46
lines changed

enigme finale (another copy)/enigme finale (another copy)/main.c

Lines changed: 0 additions & 46 deletions
This file was deleted.

include/enemy.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#ifndef ENEMY_H
2+
#define ENEMY_H
3+
4+
typedef struct
5+
{
6+
SDL_Rect img_pos; // position of the sprite on the screen
7+
SDL_Rect img_size; // size of the sprite
8+
SDL_Surface *img; // pointer to the sprite image
9+
int direction; // 0 for idle, 1 for right , 2 for left
10+
float speed; // steps per frame
11+
int max_steps; // maximum number of steps before changing direction
12+
int idle_time; // time when the enemy started idling
13+
int x; // position of the enemy in the grid (screen coordinates)
14+
int y; // position of the enemy in the grid (screen coordinates)
15+
} enemy;
16+
17+
void initEnemy(enemy *e);
18+
void drawEnemy(SDL_Surface *screen, enemy e);
19+
void animateEnemy(enemy *e, int direction);
20+
void moveEnemy(enemy *e); //! added new parameter dont forget
21+
int collisionBB(SDL_Rect player, SDL_Rect enemy);
22+
23+
//****************************************************
24+
25+
void initEnemytest(enemy *e);
26+
void drawEnemytest(SDL_Surface *screen, enemy e);
27+
void animateEnemytest(enemy *e, int direction);
28+
void moveEnemytest(enemy *e);
29+
30+
#endif

0 commit comments

Comments
 (0)