-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreature.h
76 lines (60 loc) · 2.13 KB
/
creature.h
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#pragma once
#include "SDL2/SDL.h"
#include "list.h"
#include "level.h"
#include "physObj.h"
typedef enum
{
ctPlayer,
ctMushroom,
ctGoomba,
ctCoopa
} ECreatureType;
typedef struct
{
ECreatureType creatureType;
int16 health;
SPhysObject* physBody;
char xDir; /* -1 âëĺâî 1 âďđŕâî*/
float moveSpeed; /* ńęîđîńňü äâčćĺíč˙ ěŕęńčěŕëüíŕ˙ */
float accelSpeed; /* óńęîđĺíčĺ */
/* ňĺęńňóđű */
SDL_Texture** textures;
uint16 texCount;
/* ŕíčěŕöč˙ */
short startFrame, endFrame;
short curFrame;
float animSpeed; /* ÷ĺě ěĺíüřĺ, ňĺě áűńňđĺĺ ŕíčěŕöč˙! */
float animDelay; /* çäĺńü čäĺň íŕđŕůĺíčĺ âđĺěĺíč äî ńěĺíű ęŕäđŕ */
} SCreature;
/* íŕáîđ âńĺő ńîçäŕíčé */
SList* creatures;
/* čěčňŕöč˙ ęîíńňđóęňîđŕ */
SCreature* CreatureCreate (ECreatureType creatureType,
short health,
float x, float y,
ubyte w, ubyte h,
float moveSpeed,
SDL_Texture** textures,
unsigned short texCount,
float animSpeed);
/* čěčňŕöč˙ äĺńňđóęňîđŕ */
void CreatureDestroy (SCreature** creature);
void CreatureClearAll ();
void CreatureGetDamage (SCreature* creature, int damage);
void CreatureUpdateState (SCreature* creature);
/* îáđŕáîňęŕ ôčçčęč č äâčćĺíč˙ */
void CreatureAddImpulse (SCreature* creature, float x, float y);
void CreatureUpdatePhysics (SCreature* creature);
bool CreatureContainsPoint (SCreature* creature, float x, float y);
bool CreatureIsCollisionCreature (SCreature* c1, SCreature* c2);
bool CreatureIsCollisionLevelObject (SCreature* c1, SLevelObject* l2);
/* îáđŕáîňęŕ ŕíčěŕöčč */
void CreatureSetFrameRange (SCreature* creature, int startFrame, int endFrame);
void CreatureUpdateAnimation (SCreature* creature);
/* ăĺňňĺđű */
void CreatureGetSdlRect (SCreature* creature, SDL_Rect* rect);
SDL_Texture* CreatureGetTexture (SCreature* creature, int numFrame);
/* AI */
void CreatureUpdateAI (SCreature* creature);
void CreaturesUpdateAndRender();