-
Notifications
You must be signed in to change notification settings - Fork 0
/
AngryDog.cpp
37 lines (30 loc) · 754 Bytes
/
AngryDog.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
#include "AngryDog.h"
#include <iostream>
AngryDog::AngryDog()
{
xdir = 20;//how far it moves for each time out
ydir = 20;
rect = image.rect();
rect.setWidth(60);//sets the dimensions of the Dog
rect.setHeight(4);
}
AngryDog::AngryDog(int xSpeed)
{
xdir = xSpeed;//how far it moves for each time out
ydir = xSpeed;
rect = image.rect();
rect.setWidth(60);//sets the dimensions of the Dog
rect.setHeight(40);
}
AngryDog::~AngryDog() {//destructor.
}
void AngryDog::autoMove()//moves to the left
{
if (xdir > 0){
image.load(":/icons/images/Dog_Right.png");
}
else if(xdir < 0){
image.load(":/icons/images/Dog_Left.png");
}
rect.translate(xdir, ydir);
}