The Game Engine  1
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 
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 
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