Store user data in $HOME
[kball.git] / include / cball.h
blob6ef54e95e240928d123494038dcccaeb19239ea9
1 // ------------------------------------------------------------------
2 // cball.h
3 // ------------------------------------------------------------------
4 // This class is the ball of the player
5 // By Kronoman - In loving memory of my father
6 // Copyright (c) 2003,2004, Kronoman
7 // ------------------------------------------------------------------
9 #ifndef CBALL_H
10 #define CBALL_H
12 #include <allegro.h>
14 #include "tmap.h" // I need to know the map where I move
15 #include "control.h" // the controller class
16 #include "partmang.h" // particle manager
17 #include "particle.h"
18 #include "sound.h"
20 // values that "int CBall::update_logic()" may return
21 // all OK
22 #define CBALL_IS_FINE 0
23 // I'm so dead :'(
24 #define CBALL_IS_DEAD 1
25 // I'm over the level's exit ;^D
26 #define CBALL_EXIT_LEVEL 2
29 // lives by default for SINGLE level
30 #define BALL_LIVES 3
31 // lives by default for campaign mode
32 #define BALL_LIVES_CAMPAIGN 7
34 // acceleration
35 #define BALL_SPEED_X 0.65
36 #define BALL_SPEED_Y 0.65
37 #define BALL_SPEED_Z 0.35
39 // radius of the ball (diameter will be this size * 2
40 #define BALL_RADIUS 25
42 // max speed in any axis
43 #define BALL_MSPEED 10
45 // friction
46 #define N_BALL_SPEED_X 0.1
47 #define N_BALL_SPEED_Y 0.1
48 // gravity
49 #define N_BALL_SPEED_Z 0.15
51 // max Z value of the ball (jump limit)
52 #define BALL_MAX_Z 15.0
54 // min value of Z, below here, is DEAD
55 #define BALL_MIN_Z -15.0
57 class CBall
59 public:
60 CBall();
61 ~CBall();
63 void draw(BITMAP *bmp, int sx, int sy); // draw the ball
65 int update_logic(); // updates the logic, returns status of the ball
67 // -- Data members (all public) --
68 // this vars are public to let easy access to them, (yes, I know that this broke the encapsulation)
70 float x, y, z, dx, dy, dz; // pos x,y,z ; speed dx, dy, dz
72 BITMAP *spr; // sprite (texture of sphere, will be the size of texture too)
73 BITMAP *spr_shadow; // shadow mask for the sphere texture
75 BITMAP *spr_cache; // cache for sphere rotaded sprite
77 float anglex, angley; // angle of rotation of the sprite (to animate it)
79 int lives; // lives left
80 long int score; // score
82 CTMap *ctmap; // pointer to the map where the ball moves, the ball NEEDS to know the map
84 CParticleManager *particle_manager; // pointer to game's particle manager, the ball NEEDS to add particles when get pickups, etc
86 CController control; // controller for gameplay
88 CSoundWrapper soundw; // sound system
91 #endif