bzr branch
http://gegoxaren.bato24.eu/bzr/%2Bjunk/invaders_vala
2
by Gusatv Hartvigsson
* moved a file ( miss spelled name) |
1 |
using SDL; |
2 |
using SDLGraphics; |
|
7
by Gusatv Hartvigsson
* added gee-1.0 to Makefile. |
3 |
using SDLImage; |
2
by Gusatv Hartvigsson
* moved a file ( miss spelled name) |
4 |
|
5 |
namespace invadersGame{ |
|
7
by Gusatv Hartvigsson
* added gee-1.0 to Makefile. |
6 |
|
2
by Gusatv Hartvigsson
* moved a file ( miss spelled name) |
7 |
class GameObject : Object{ |
9
by Gustav Hartvigsson
Implimented Time based movement... |
8 |
|
9 |
protected SDL.Rect my_rect; |
|
10 |
|
|
11 |
protected float speed; |
|
12 |
protected float pos_x; |
|
13 |
protected float pos_y; |
|
14 |
protected uint32 last_frame; |
|
15 |
|
|
7
by Gusatv Hartvigsson
* added gee-1.0 to Makefile. |
16 |
public struct MovmentVector { |
17 |
/** MovmentVector |
|
18 |
* Is used for storting a movement vector.
|
|
19 |
* IE: if it should move up (y < 0), up (y > 0), left (x < 0),
|
|
20 |
* right (x > 0).
|
|
21 |
*/
|
|
9
by Gustav Hartvigsson
Implimented Time based movement... |
22 |
int delta_x; /* The delta of the object can have thee states: |
23 |
delta_x < 0, delta_x = 0 or delta_x > 0*/
|
|
24 |
int delta_y; /* See above */ |
|
25 |
int speed; /* Maximum movement over Time (in seconds) */ |
|
7
by Gusatv Hartvigsson
* added gee-1.0 to Makefile. |
26 |
} //MovmentVector |
27 |
|
|
9
by Gustav Hartvigsson
Implimented Time based movement... |
28 |
int health; /* HP */ |
29 |
|
|
7
by Gusatv Hartvigsson
* added gee-1.0 to Makefile. |
30 |
MovmentVector mMovmentVector; |
31 |
|
|
9
by Gustav Hartvigsson
Implimented Time based movement... |
32 |
public GameObject(int16 x, int16 y, int delta_x, int delta_y, |
33 |
int speed, int health){ |
|
34 |
|
|
35 |
my_rect = SDL.Rect (); |
|
36 |
my_rect.x = x; |
|
37 |
my_rect.y = y; |
|
38 |
pos_x = x; |
|
39 |
pos_y = y; |
|
40 |
|
|
41 |
this.speed = speed; |
|
42 |
last_frame = SDL.Timer.get_ticks(); |
|
43 |
} |
|
44 |
|
|
45 |
public virtual void draw(SDL.Screen screen) { |
|
46 |
ResourceHandler.image_null.blit(null ,screen,my_rect); |
|
47 |
} |
|
48 |
|
|
49 |
public virtual void move() { |
|
50 |
// Do nothing! |
|
51 |
} |
|
2
by Gusatv Hartvigsson
* moved a file ( miss spelled name) |
52 |
} |
53 |
}
|
|
9
by Gustav Hartvigsson
Implimented Time based movement... |
54 |
|
55 |
||
56 |
||
57 |
||
58 |