C++ Project 2016-2017: Arkanoid
src
arkanoid
logic
entity
player
player.cpp
Go to the documentation of this file.
1
3
#include "
player.h
"
4
#include "../../math/vector2D.h"
5
6
#include <iostream>
7
8
using namespace
std
;
9
10
namespace
arkanoid
{
11
12
Player::Player() {}
13
14
Player::Player(
double
x,
double
y,
double
newSpeed, pair<double, double> size) : velocity(newSpeed, 0), speed(newSpeed), origin(x, y), originalSpeed(newSpeed), notMoving(true),
Entity
(x, y, size) {}
15
16
Player::~Player
() {}
17
18
void
Player::update
() {}
19
20
void
Player::draw
()
const
{}
21
22
void
Player::speedUp
(
double
factor) {
23
if
(
speedUpDuration
== 0) {
24
// Prevent multiple speed ups
25
speed *= factor;
26
speedUpDuration
= 180;
// 180 frames = 3 seconds
27
}
28
}
29
30
void
Player::reset
() {
31
speed = originalSpeed;
32
position
=
origin
;
33
notMoving =
true
;
34
speedUpDuration
= 0;
35
}
36
37
}
arkanoid::Player::update
void update()
Definition:
player.cpp:18
arkanoid::Player::reset
virtual void reset()
Definition:
player.cpp:30
arkanoid::Player::origin
Vector2D origin
The initial position of the Player.
Definition:
player.h:21
arkanoid::Player::speedUp
void speedUp(double factor)
Definition:
player.cpp:22
arkanoid::Player::~Player
~Player()
Definition:
player.cpp:16
std
arkanoid::Entity::position
Vector2D position
The current position of the Entity (in the 9x7 grid).
Definition:
entity.h:17
player.h
arkanoid::Player::speedUpDuration
int speedUpDuration
In frames.
Definition:
player.h:25
arkanoid::Player::draw
void draw() const
Definition:
player.cpp:20
arkanoid
All the game logic of the Arkanoid game.
Definition:
ball.cpp:15
arkanoid::Entity
An Entity represents an "object" (like Player, Ball, Block, ...) in the game World.
Definition:
entity.h:15
Generated by
1.8.13