-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClaseBala.h
79 lines (67 loc) · 1.24 KB
/
ClaseBala.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#pragma once
#include "ClasePadre.h"
using namespace System;
class Bala : public Objeto
{
protected:
int velocidad, danio;
float base, altura;
int random;
public:
Bala() : Objeto(0, 0, 0, 0)
{
//inicio dx n dy como 0
base = 20; altura = 20;
danio = 1;
velocidad = 5;
//Random r;
//random = r.Next(1, 25);
}
~Bala() {}
void setDanio(int nuevo) { danio = nuevo; }
void drawBala(Graphics^ buffer, SolidBrush^ pilot)
{
Pen^lapicero = gcnew Pen(Color::SkyBlue, 5);
buffer->DrawEllipse(lapicero, x, y, 25, random);
buffer->FillEllipse(pilot, x, y, 25, 25);
}
void LiberarBala(int pos, int x, int y)
{
this->x = x + 25;
this->y = y + 25;
switch (pos)
{
case 1: //izq
dx = -velocidad;
dy = 0;
break;
case 2: //derech
dx = velocidad;
dy = 0;
break;
case 3: //arriba
dx = 0;
dy = -velocidad;
break;
case 0:
dx = 0;
dy = velocidad;
break;
default:break;
}
}
void moverBala(Graphics^ buffer, SolidBrush^ pilot)
{
x += dx;
y += dy;
drawBala(buffer, pilot);
//cout << dx << " \ t " << dy << endl;
}
bool ColisionEnemigos()
{
}
/*string getdanio()
{
return to_string(danio);
}*/
};