Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F633513
Velocity.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
881 B
Referenced Files
None
Subscribers
None
Velocity.h
View Options
//
// Created by Ido Mozes on 02/07/2019.
//
#ifndef SDL_GAME_VELOCITY_H
#define SDL_GAME_VELOCITY_H
#include
<cmath>
#include
"../Physics.h"
#include
"../Component.h"
class
Velocity
:
public
Component
{
public
:
Point
value
;
static
constexpr
ComponentType
type
=
ComponentType
::
VELOCITY
;
Velocity
(
float
x
,
float
y
);
void
setVelocity
(
float
x
,
float
y
)
{
value
=
{
x
,
y
};
}
void
changeVelocity
(
float
deltaX
,
float
deltaY
)
{
value
.
X
+=
deltaX
;
value
.
Y
+=
deltaY
;
}
void
turnDirection
(
float
deltaRad
);
void
setDirection
(
float
rad
);
void
setSpeed
(
float
speed
);
void
changeSpeed
(
float
deltaSpeed
);
};
class
Acceleration
:
public
Velocity
{
public
:
static
constexpr
ComponentType
type
=
ComponentType
::
ACCELERATION
;
Acceleration
(
float
x
,
float
y
)
:
Velocity
(
x
,
y
)
{}
};
#endif
//SDL_GAME_VELOCITY_H
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sun, Nov 15, 5:03 PM (11 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
134357
Default Alt Text
Velocity.h (881 B)
Attached To
Mode
R74 BloonsTD
Attached
Detach File
Event Timeline