-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathball.h
More file actions
42 lines (39 loc) · 995 Bytes
/
ball.h
File metadata and controls
42 lines (39 loc) · 995 Bytes
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
#pragma once
#include"Tile.h"
#include"hole.h"
#include"math.h"
#include"Entity.h"
#include<vector>
using namespace std;
class Ball :public Entity
{
private:
coordinates velocity;
coordinates pos_target;
coordinates launch_velocity;
coordinates i_mouse_pos;
float speed;
float launch_speed;
float friction = 0.001;
bool can_move;
bool win = false;
int index;
int direction_x = 1;
int direction_y = 1;
int strokes = 0;
vector<Entity> grade_points;
vector<Entity> powerbar;
public:
Ball(coordinates pos,SDL_Texture* tex, SDL_Texture* point_tex, SDL_Texture* p_powerMXFG, SDL_Texture* p_powerMXBG, int index):Entity(pos,tex)
{
this->index = index;
grade_points.push_back(Entity(coordinates(-64, -64), point_tex));
powerbar.push_back( Entity(coordinates(-64, -64), p_powerMXBG));
powerbar.push_back(Entity(coordinates(-64, -64), p_powerMXFG));
}
void set_velocity(float x , float y)
{
velocity.x = x;
velocity.y = y;
}
};