-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVehicle.cpp
58 lines (46 loc) · 1.01 KB
/
Vehicle.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
#include "Vehicle.h"
#include <iostream>
Vehicle::Vehicle()
{
xdir = 0; // how far it moves for each time out
ydir = 0;
}
Vehicle::Vehicle(int xSpeed,int ySpeed){
xdir = xSpeed;
ydir = ySpeed;
}
Vehicle::~Vehicle() {//destructor.
}
void Vehicle::movePositioning(int xcoordinate, int ycoordinate)//moves the var to this X and Y coordinate in the window.
{
rect.moveTo(xcoordinate,ycoordinate);
}
void Vehicle::moveBottom(int bottom)//move one step down.
{
rect.moveBottom(bottom);
}
void Vehicle::moveTop(int top)//move one step up.
{
rect.moveTop(top);
}
void Vehicle::moveLeft(int left)//move one step to left.
{
rect.moveLeft(left);
}
void Vehicle::moveRight(int right)//move to right.
{
rect.moveRight(right);
}
QRect Vehicle::getRect()//returns the rectangle type.
{
return rect;
}
QImage & Vehicle::getImage()//sets the image as the rectangle.
{
return image;
}
/*
void Vehicle::autoMove(){
rect.translate(xdir, ydir);
}
*/