File: wormhole.cpp

package info (click to toggle)
clanlib 0.5.4-1-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 10,320 kB
  • ctags: 10,893
  • sloc: cpp: 76,056; xml: 3,281; sh: 2,961; perl: 1,204; asm: 837; makefile: 775
file content (81 lines) | stat: -rw-r--r-- 1,389 bytes parent folder | download
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
#ifdef WIN32
#pragma warning (disable:4786)
#endif

#include "wormhole.h"

/////////////////////////////////////////////////////////////////////////////
// Wormhole construction:

Wormhole::Wormhole(World *world)
:
	GameObject(world, GameObject::WORMHOLE)
{
	init();
}

Wormhole::Wormhole(World *world, CL_NetObject netobj)
:
	GameObject(world, GameObject::WORMHOLE, netobj)
{
	init();
}

Wormhole::~Wormhole()
{
}

void Wormhole::init()
{
	angle = 0;
	speed = 20;
	position_x = 0;
	position_y = 0;
}

/////////////////////////////////////////////////////////////////////////////
// Wormhole attributes:

float Wormhole::get_position_x() const
{
	return position_x;
}

float Wormhole::get_position_y() const
{
	return position_y;
}

float Wormhole::get_direction() const
{
	return angle;
}

/////////////////////////////////////////////////////////////////////////////
// Wormhole operations:

void Wormhole::set_position_x(float pos)
{
	position_x = pos;
}

void Wormhole::set_position_y(float pos)
{
	position_y = pos;
}

void Wormhole::set_rotation_speed(float speed)
{
	this->speed = speed;
}

/////////////////////////////////////////////////////////////////////////////
// Wormhole overrideables:

void Wormhole::update(float time_elapsed)
{
	angle += speed * time_elapsed;
}

/////////////////////////////////////////////////////////////////////////////
// Wormhole implementation: