The Game Engine
1
Main Page
Related Pages
Classes
Files
File List
File Members
Behaviors.h
Go to the documentation of this file.
1
#ifndef __BEHAVIORS_H__
2
#define __BEHAVIORS_H__
3
#include <vector>
4
#include <string>
5
#include "
Game.h
"
6
#include "
fns.h
"
7
8
using
std::vector;
9
using
std::string;
10
12
14
void
sunParticleInit
()
15
{
16
Game
* g =
Game::game
();
17
//rand cloud-like velocity
18
float
randAngle =
randFloat
() * (float)PI * 2.0f;
19
int
speed =
randInt
(1, 7);
20
21
//gets velocity from random #s
22
g->
CurrentParticle
->
Velocity
=
getVector
(randAngle, speed);
23
24
g->
CurrentParticle
->
Position
=
Point2D
(0, 0);
//point is relative to start of particle spawnpoint
25
g->
CurrentParticle
->
Life
=
randInt
(30,45);
26
g->
CurrentParticle
->
Size
= 2;
27
}
28
30
void
sunParticleUpdate
()
31
{
32
Game
* g =
Game::game
();
33
34
float
zeroToOne = g->
CurrentParticle
->
Life
/45.0f;
35
36
g->
CurrentParticle
->
Color
.
A
=(Uint8)(zeroToOne * 255);
37
}
38
39
#endif
Behaviors.h
Generated on Tue Apr 16 2013 02:32:41 for The Game Engine by
1.8.3.1