-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhook.cpp
67 lines (65 loc) · 1.26 KB
/
hook.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
#include "hook.hpp"
#include <iostream>
using namespace std;
#pragma once
Hook::Hook(SDL_Texture *tex) : Unit(1, tex)
{
//numbers = 100; //These could be number of hooks.
moveHk = 0;
hookBool = 0;
cout << "hook created" << endl;
}
void Hook::updateHookRight()
{
mover.x += 2 + move_speed / 1000;
}
int Hook::GetHookBool()
{
return hookBool;
}
void Hook::updateHookLeft()
{
mover.x -= 2 + move_speed / 1000;
}
int Hook::moveHook()
{
if (mover.y <= 570 && mover.y >= 560)
{
moveHk = 1;
hookBool = 1;
}
if (mover.y <= 600 && moveHk == 0)
{
mover.y += 5;
hookBool = 1;
}
else if (mover.y > 48 && moveHk == 1)
{
mover.y -= 7;
hookBool = 1;
}
else
{
hookBool = 0;
moveHk = 0;
}
return hookBool;
}
void Hook::update_speed(int a)
{
if (move_speed < 2000)
move_speed += a;
}
void Hook::reduce()
{
if (move_speed > 0)
move_speed--;
}
int Hook::operator+(Anime *RHS) //Operator Overloading (Used in game.cpp line 137)
{
return RHS->get_version();
}
int Hook::operator*(Fishes *RHS) //Operator Overloading (Used in game.cpp line 137)
{
return RHS->get_points();
}