/+junk/invaders_vala

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/invaders_vala
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
using SDL;
using SDLGraphics;
using SDLImage;

namespace invadersGame{
  
  class GameObject : Object{
    
    protected SDL.Rect my_rect;
    
    protected float speed;
    protected float pos_x;
    protected float pos_y;
    protected uint32 last_frame;
    
    public struct MovmentVector {
      /** MovmentVector
       * Is used for storting a movement vector.
       * IE: if it should move up (y < 0), up (y > 0), left (x < 0),
       * right (x > 0).
       */
      int delta_x; /* The delta of the object can have thee states:
                    delta_x < 0,  delta_x = 0  or delta_x > 0*/
      int delta_y; /* See above */
      int speed; /* Maximum movement over Time (in seconds) */
    } //MovmentVector
    
    int health; /* HP */
    
    MovmentVector mMovmentVector;
    
    public GameObject(int16 x, int16 y, int delta_x, int delta_y,
                      int speed, int health){
      
      my_rect = SDL.Rect ();
      my_rect.x = x;
      my_rect.y = y;
      pos_x = x;
      pos_y = y;
      
      this.speed = speed;
      last_frame = SDL.Timer.get_ticks();
    }
    
    public virtual void draw(SDL.Screen screen) {
      ResourceHandler.image_null.blit(null ,screen,my_rect);
    }
    
    public virtual void move() {
      // Do nothing!
    }
  }
}