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
|
using SDL;
using SDLGraphics;
using SDLImage;
namespace invadersGame{
public SDL.Surface GameObjectImage;
class GameObject : Object{
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 x;
int y;
int Speed; /* Maximum movement over Time */
int Time; /* The time it takes to move */
} //MovmentVector
MovmentVector mMovmentVector;
public GameObject(){
GameObjectImage = SDLImage.load("media/images/null.png");
mMovmentVector = {
Game.getRandom(SCREEN_WIDTH),
Game.getRandom(SCREEN_HEIGHT),
0,
0
};
stdout.printf("X: %i, Y: %i\n", mMovmentVector.x, mMovmentVector.y);
mMovmentVector.x = 10;
stdout.printf("New X: %i, Y: %i\n", mMovmentVector.x, mMovmentVector.y);
}
}
}
|