-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstorage.cpp
More file actions
85 lines (78 loc) · 2.3 KB
/
storage.cpp
File metadata and controls
85 lines (78 loc) · 2.3 KB
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
77
78
79
80
81
82
83
84
85
#include "storage.h"
//------------------------------------------------------------------------------------------------------
// defFlying() er en funksjon for å definere de ulike vesnene
void defFlying(Flyvende *vesen,
// int maksvx, // for maksfart i x-retning?
// int maksvy, // for maksfart i y-retning?
int life,
int antFrames,
int score,
BITMAP *sprite)
{
vesen->life = life;
vesen->antFrames = antFrames;
vesen->score = score;
vesen->sprite = sprite;
vesen->animtime = 0;
vesen->vx = 0;
vesen->vy = 0;
vesen->x = 0;
vesen->y = 0;
}
void defDucks(Ducks *d,
// int maksvx, // for maksfart i x-retning?
// int maksvy, // for maksfart i y-retning?
int maxleft,
int maxright,
int x,
int y,
int vx,
int vy,
int dir,
BITMAP *sprite
)
{
d->maxleft = maxleft;
d->maxright = maxright;
d->x = x;
d->y = y;
d->vx = vx;
d->vy = vy;
d->dir = dir;
d->sprite = sprite;
}
//------------------------------------------------------------------------------------------------------
// posFlying() skal plassere et flyvende vesen og gi den fart
void posFlying(Flyvende *vesen, int x, int y, int vx, int vy, int type){
vesen->x = x;
vesen->y = y;
vesen->vx = vx;
vesen->vy = vy;
vesen->type = type;
}
//------------------------------------------------------------------------------------------------------
void createTowerman(Towerman *t, int maxShoots, int frames, int strength, int x, int y, BITMAP *sprite,
BITMAP *p_sprite){
t->maxShoots = maxShoots;
t->antFrames = frames;
t->sprite = sprite;
t->shoots = 0;
t->frame = 0;
t->strength = strength;
t->x = x;
t->y = y;
t->aimAngle = 45;
t->animtime = 0;
for (int i=0; i<MAX_PROJECTILES; i++){
createProjectile(&t->projectiles[i], 1, p_sprite);
}
}
//------------------------------------------------------------------------------------------------------
void createProjectile(Prosjektil *p, int antFrames, BITMAP *sprite){
p->sprite = sprite;
p->onBoard = 0;
p->frame = 0;
p->antFrames = antFrames;
p->animtime = 0;
p->angle = 0;
}