File: entity.h

package info (click to toggle)
enemylines3 1.2-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,380 kB
  • ctags: 1,444
  • sloc: cpp: 16,323; makefile: 74; sh: 52
file content (96 lines) | stat: -rw-r--r-- 1,418 bytes parent folder | download | duplicates (6)
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
86
87
88
89
90
91
92
93
94
95
96
#ifndef __el3__entity_h
#define __el3__entity_h

#include <iostream>
#include <vector>

#include "coordinate.h"
#include "entitytype.h"
#include "tweak/tweak.h"

namespace el3 {

class Container;
class Game;

class Entity {

	C3f dest;
	Entity * mdest;
	float destroty;
	Container *container_;
	Game *game_;
	unsigned int exploding;
	unsigned int lastnewdest;

	bool snap();
	void init();
	void lookatdest();
	bool trymove(C3f d);
	bool trymove_single(C3f d);

	C3 collision;

	float speed;

	bool m_forward,m_backward,m_left,m_right;
	e_entitytype type;
public:
	bool remove;
	

	C3f rot;
	C3f pos;
	C3f dir;

	unsigned int myticks;

	unsigned int jumping;

	Entity();

	void set_type(e_entitytype t);
	void set_container(Container *c) { container_=c; }
	void set_game(Game *g) { game_=g; }

	e_entitytype get_type();

	void draw();
	bool isactive();
	

	C3f gunpos();

	void act(unsigned int ticks);
	void tick(unsigned int ticks);

	void new_dest();
	void hit();
	void explode();

	void move_direction(C3f r,float mod=1.0f);
	void move_forward(float mod=1.0f);
	void move_backward(float mod=1.0f);
	void move_left(float mod=1.0f);
	void move_right(float mod=1.0f);


	void mark_move_forward();
	void mark_move_backward();
	void mark_move_left();
	void mark_move_right();

	void turn_up();
	void turn_down();
	void turn_left();
	void turn_right();
	void turn(int x,int y);

	void jump();

};


} //namespace

#endif