1#include "../Header files/GameClass.h";
2#include "../Header files/El Octavo-Functions.h"
3#include "../Header files/Menu.h"
4#include "../Header files/Precompile.h"
18 this->imageCount = imageCount;
19 this->switchTime = switchTime;
21 this->totalTime = 0.0f;
22 this->currentImage.
x = 0;
29 this->faceLeft =
true;
49 if (totalTime >= switchTime)
51 totalTime -= switchTime;
54 if (currentImage.
x >= imageCount.
x)
89 if (Keyboard::isKeyPressed(Keyboard::D))
106 if (Keyboard::isKeyPressed(Keyboard::A)) {
115 if (Keyboard::isKeyPressed(Keyboard::D))
124 if (!Keyboard::isKeyPressed(Keyboard::D) && !Keyboard::isKeyPressed(Keyboard::A) && !Keyboard::isKeyPressed(Keyboard::W) && !Keyboard::isKeyPressed(Keyboard::S)) {
132 if (Keyboard::isKeyPressed(Keyboard::Space)) {
151 if (Keyboard::isKeyPressed(Keyboard::D))
159 if (Keyboard::isKeyPressed(Keyboard::W))
168 if (Keyboard::isKeyPressed(Keyboard::S))
222 for (
int i = 0; i < 2; i++) {
229 if (bodyX > hitboxX + hitboxSizeX && bodyY > hitboxY) {
233 else if (bodyX < hitboxX && bodyY > hitboxY) {
238 if ((bodyY < hitboxY + hitboxSizeY && not bodyX < hitboxX) or (bodyY < hitboxY + hitboxSizeY && not bodyX > hitboxX + hitboxSizeX)) {
246 else if (((bodyY > hitboxY && not bodyX < hitboxX) or (bodyY > hitboxY && not bodyX < bodyX >= hitboxX + hitboxSizeX)) && i != 0) {
268 if (Keyboard::isKeyPressed(Keyboard::D)) {
274 else if (Keyboard::isKeyPressed(Keyboard::A)) {
283 else if (bodyX >
getRampPos().x + 110 && (bodyX - (
getRampPos().x + 110) < 30.0f) && bodyY > 450 && !ramped) {
284 cout << bodyY << endl;
305 velocity.
y = -sqrtf((160.0f * jumpHeight) * 0.016);
bool checkCollideWithRamp(RectangleShape &body)
bool checkCollideWithGround(RectangleShape &body)
void moveCharacter(int &keyTime, RenderWindow &window, Sprite &adventureBgImage, float &deltaTime)
void jump(float deltaTime, float jumpHeight)
void updateMovement(float deltaTime, RenderWindow &window, Sprite &adventureBgImage, Sound &soundWalk, Sound &soundJump, bool &toggle, CollisionBlock blocks[], int blocksSize)
void draw(RenderWindow &window)
void update(int row, float deltaTime, bool faceLeft)
void moveCameraFirstStage(Sprite &image, float &deltaTime)
Player(Texture *texture, Vector2u imageCount, float switchTime, float speed)
Utility class that measures the elapsed time.
Time restart()
Restart the clock.
Time getElapsedTime() const
Get the elapsed time.
T width
Width of the rectangle.
T height
Height of the rectangle.
T left
Left coordinate of the rectangle.
T top
Top coordinate of the rectangle.
void setSize(const Vector2f &size)
Set the size of the rectangle.
const Vector2f & getSize() const
Get the size of the rectangle.
void draw(const Drawable &drawable, const RenderStates &states=RenderStates::Default)
Draw a drawable object to the render target.
Window that can serve as a target for 2D drawing.
virtual Vector2u getSize() const
Get the size of the rendering region of the window.
void setTextureRect(const IntRect &rect)
Set the sub-rectangle of the texture that the shape will display.
void setTexture(const Texture *texture, bool resetRect=false)
Change the source texture of the shape.
Regular sound that can be played in the audio environment.
void play()
Start or resume playing the sound.
Status getStatus() const
Get the current status of the sound (stopped, paused, playing)
void stop()
stop playing the sound
Drawable representation of a texture, with its own transformations, color, etc.
Image living on the graphics card that can be used for drawing.
Vector2u getSize() const
Return the size of the texture.
float asSeconds() const
Return the time value as a number of seconds.
T x
X coordinate of the vector.
T y
Y coordinate of the vector.
Vector2< float > Vector2f