forked from piergo98/Ping-pong-robot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pallina.h
65 lines (57 loc) · 2.89 KB
/
Pallina.h
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
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <allegro.h>
#include <pthread.h>
#include <time.h>
#include "Avversario.h"
//---------------------------------------------------------------------------------------------
// COSTANTI FISICHE
//---------------------------------------------------------------------------------------------
#define G0 9.8 // acceleration of gravity
#define HMIN 200 // min initial height
#define HMAX 390 // max initial height
#define VXMIN 20 // min initial hor. speed
#define VXMAX 10 // max initial hor. speed
#define Y_0 20 // initial heigth
#define DAMP_X 0.001 // damping coefficient
#define DAMP_Z 0.0001 // damping coefficient
#define BETA 0.2 // adimensional braking coefficient
//---------------------------------------------------------------------------------------------
// LIMITI ERRORI CASUALI
//---------------------------------------------------------------------------------------------
#define ERR_MIN -7
#define ERR_MAX 7
//---------------------------------------------------------------------------------------------
// LUNGHEZZA E LARGHEZZA AREA DI GIOCO (640X480)
//---------------------------------------------------------------------------------------------
#define WIDTH_GAME 640
#define HEIGHT_GAME 768
#define DELTA 128 //traslazione lungo z della zona di gioco
//---------------------------------------------------------------------------------------------
// COORDINATE INIZIALI DELLA PALLINA
//---------------------------------------------------------------------------------------------
#define INIT_X 320
#define INIT_Z 248
#define BALL_RADIUS 5
#define VZ_FACILE 20
#define VZ_MEDIO 30
#define VZ_DIFFICILE 40
#define VZ_ESTREMA 50
//---------------------------------------------------------------------------------------------
// DIMENSIONI RACCHETTA
//---------------------------------------------------------------------------------------------
#define RACC_MAX 20 // max racchetta
#define RACC_MIN 20 // min racchetta
//---------------------------------------------------------------------------------------------
// DIMENSIONI RACCHETTA
//---------------------------------------------------------------------------------------------
#define EPS 30 // offset usato per le condizioni di rimbalzo
//---------------------------------------------------------------------------------------------
int p_rob; //punteggio robot
int p_avv; //punteggio avversario
void handle_bounce(int i);
float frand(float vxmin, float vxmax);
void init_ball(void);
void* balltask(void* arg);
void chi_gioca();