forked from lralvarez91/Game
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shooter.cpp
69 lines (53 loc) · 827 Bytes
/
shooter.cpp
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
#include "shooter.h"
#include <iostream>
Shooter::Shooter()
{
xdir = 0;
ydir = 5;
image.load("shooter.png");//load image
rect=image.rect();//assign image
resetState();//respawn
}
Shooter::~Shooter(){
std::cout<<("Shooter deleted\n");
}
void Shooter::resetState()
{
rect.moveTo(-1000,100);//location
}
QRect Shooter::getRect()
{
return rect;
}
QImage & Shooter::getImage()
{
return image;
}
void Shooter::moveBottom(int bottom)
{
rect.moveBottom(bottom);
}
void Shooter::moveTop(int top)
{
rect.moveTop(top);
}
void Shooter::autoMove()//checks if zombie hits the window edge and "bounces" back
{
rect.translate(xdir, ydir);
}
void Shooter::setXDir(int x)
{
xdir = x;
}
void Shooter::setYDir(int y)
{
ydir = y;
}
int Shooter::getXDir()
{
return xdir;
}
int Shooter::getYDir()
{
return ydir;
}