-
Notifications
You must be signed in to change notification settings - Fork 0
/
ObjectGroupStraight.cpp
63 lines (50 loc) · 1.89 KB
/
ObjectGroupStraight.cpp
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
//------------------------------------------------------------------------------
// File: ObjectGroupStraight.cpp
// Desc: Makes objects move in a straight line down the screen
//
// Created: 27 September 2005 18:26:27
//
// (c)2005 Neil Wakefield, Lionhead Studios Ltd
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Included files:
//------------------------------------------------------------------------------
#include "ObjectGroupStraight.h"
#include "Object.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
//------------------------------------------------------------------------------
// Definitions:
//------------------------------------------------------------------------------
ObjectGroupStraight::ObjectGroupStraight()
{
}
//------------------------------------------------------------------------------------------------------------
ObjectGroupStraight::~ObjectGroupStraight()
{
}
//------------------------------------------------------------------------------------------------------------
bool ObjectGroupStraight::InitialiseObjectMovement()
{
if( Objects.size() == 0 )
{
OutputDebugStringA( "PT_ERROR: No objects in group\n" );
return false;
}
//Line up the objects so they fly through the start position
D3DXVECTOR2 pos = Position;
D3DXVECTOR2 sep = Direction * (*(Objects.begin()))->GetCollisionRadius() * 2.0f;
for( ObjectList::iterator iter = Objects.begin(); iter != Objects.end(); ++iter )
{
Object *object = *iter;
object->SetPosition( pos );
pos -= sep;
object->SetThrust( Direction );
}
return true;
}
//------------------------------------------------------------------------------------------------------------
bool ObjectGroupStraight::ProcessObjectMovement()
{
return true;
}