Skip to content

Commit

Permalink
Added animation tu turtles and cars
Browse files Browse the repository at this point in the history
  • Loading branch information
BSalwiczek committed Dec 26, 2019
1 parent 08bb602 commit bca0c31
Show file tree
Hide file tree
Showing 41 changed files with 422 additions and 149 deletions.
Binary file modified Debug/Base.obj
Binary file not shown.
Binary file added Debug/Bee.obj
Binary file not shown.
Binary file modified Debug/Car.obj
Binary file not shown.
Binary file modified Debug/Entity.obj
Binary file not shown.
Binary file modified Debug/Frog.obj
Binary file not shown.
Binary file modified Debug/Game.obj
Binary file not shown.
Binary file modified Debug/LittleFrog.obj
Binary file not shown.
Binary file modified Debug/Scene.obj
Binary file not shown.
Binary file modified Debug/Turtle.obj
Binary file not shown.
Binary file modified Debug/Wood.obj
Binary file not shown.
Binary file modified Debug/main.obj
Binary file not shown.
Binary file modified Debug/szablon2vs19.exe
Binary file not shown.
Binary file modified Debug/szablon2vs19.ilk
Binary file not shown.
95 changes: 84 additions & 11 deletions Debug/szablon2vs19.log
Original file line number Diff line number Diff line change
@@ -1,19 +1,92 @@
 Game.cpp
C:\Users\barto\Desktop\Frogger\src\Game.cpp(49,1): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
 Base.cpp
Bee.cpp
Car.cpp
Entity.cpp
Frog.cpp
C:\Users\barto\Desktop\Frogger\src\Car.cpp(77,43): warning C4018: '>': signed/unsigned mismatch
C:\Users\barto\Desktop\Frogger\src\Frog.cpp(117,17): warning C4244: '-=': conversion from 'double' to 'int', possible loss of data
C:\Users\barto\Desktop\Frogger\src\Frog.cpp(120,17): warning C4244: '+=': conversion from 'double' to 'int', possible loss of data
C:\Users\barto\Desktop\Frogger\src\Frog.cpp(123,17): warning C4244: '-=': conversion from 'double' to 'int', possible loss of data
Game.cpp
C:\Users\barto\Desktop\Frogger\src\Frog.cpp(126,17): warning C4244: '+=': conversion from 'double' to 'int', possible loss of data
C:\Users\barto\Desktop\Frogger\src\Game.cpp(53,1): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(208): message : see declaration of 'fopen'
C:\Users\barto\Desktop\Frogger\src\Game.cpp(53,1): warning C4996: 'fscanf': This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Users\barto\Desktop\Frogger\src\Game.cpp(57,1): warning C4996: 'fscanf': This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1197): message : see declaration of 'fscanf'
C:\Users\barto\Desktop\Frogger\src\Game.cpp(117,25): warning C4244: 'argument': conversion from 'double' to 'int', possible loss of data
C:\Users\barto\Desktop\Frogger\src\Game.cpp(186,58): warning C4554: '&': check operator precedence for possible error; use parentheses to clarify precedence
C:\Users\barto\Desktop\Frogger\src\Game.cpp(213,14): warning C4244: 'argument': conversion from 'double' to 'int', possible loss of data
C:\Users\barto\Desktop\Frogger\src\Game.cpp(216,28): warning C4244: 'argument': conversion from 'double' to 'int', possible loss of data
C:\Users\barto\Desktop\Frogger\src\Game.cpp(258,1): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Users\barto\Desktop\Frogger\src\Game.cpp(140,58): warning C4554: '&': check operator precedence for possible error; use parentheses to clarify precedence
C:\Users\barto\Desktop\Frogger\src\Game.cpp(167,14): warning C4244: 'argument': conversion from 'double' to 'int', possible loss of data
C:\Users\barto\Desktop\Frogger\src\Game.cpp(204,25): warning C4244: 'argument': conversion from 'double' to 'int', possible loss of data
C:\Users\barto\Desktop\Frogger\src\Game.cpp(263,27): warning C4244: 'argument': conversion from 'double' to 'int', possible loss of data
C:\Users\barto\Desktop\Frogger\src\Game.cpp(312,1): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(208): message : see declaration of 'fopen'
C:\Users\barto\Desktop\Frogger\src\Game.cpp(272,1): warning C4996: 'fscanf': This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Users\barto\Desktop\Frogger\src\Game.cpp(326,1): warning C4996: 'fscanf': This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1197): message : see declaration of 'fscanf'
C:\Users\barto\Desktop\Frogger\src\Game.cpp(293,1): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
main.cpp
C:\Users\barto\Desktop\Frogger\src\Game.cpp(347,1): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
LittleFrog.cpp
Scene.cpp
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(208): message : see declaration of 'fopen'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(53,20): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(43,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(44,1): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(208): message : see declaration of 'fopen'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(51,1): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(2263): message : see declaration of 'sscanf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(59,1): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(2263): message : see declaration of 'sscanf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(87,1): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(2263): message : see declaration of 'sscanf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(95,1): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(2263): message : see declaration of 'sscanf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(110,1): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(2263): message : see declaration of 'sscanf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(327,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(335,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(337,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(339,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(346,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(356,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(358,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(360,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(364,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(385,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(392,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(401,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(404,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(406,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(409,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(411,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(421,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(423,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(428,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(438,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Scene.cpp(440,1): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
Turtle.cpp
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\stdio.h(1774): message : see declaration of 'sprintf'
C:\Users\barto\Desktop\Frogger\src\Turtle.cpp(75,43): warning C4018: '>': signed/unsigned mismatch
Wood.cpp
main.cpp
C:\Users\barto\Desktop\Frogger\src\Turtle.cpp(95,43): warning C4018: '>': signed/unsigned mismatch
C:\Users\barto\Desktop\Frogger\src\main.cpp(17,12): warning C4244: 'argument': conversion from 'time_t' to 'unsigned int', possible loss of data
C:\Users\barto\Desktop\Frogger\src\main.cpp(155,52): warning C4554: '&': check operator precedence for possible error; use parentheses to clarify precedence
C:\Users\barto\Desktop\Frogger\src\main.cpp(10,26): warning C4101: 'distance': unreferenced local variable
Expand Down
Binary file modified Debug/szablon2vs19.pdb
Binary file not shown.
Binary file modified Debug/szablon2vs19.tlog/CL.command.1.tlog
Binary file not shown.
Binary file modified Debug/szablon2vs19.tlog/CL.read.1.tlog
Binary file not shown.
Binary file modified Debug/szablon2vs19.tlog/CL.write.1.tlog
Binary file not shown.
Binary file modified Debug/szablon2vs19.tlog/link.command.1.tlog
Binary file not shown.
Binary file modified Debug/szablon2vs19.tlog/link.read.1.tlog
Binary file not shown.
Binary file modified Debug/szablon2vs19.tlog/link.write.1.tlog
Binary file not shown.
Binary file modified Debug/vc142.idb
Binary file not shown.
Binary file modified Debug/vc142.pdb
Binary file not shown.
36 changes: 36 additions & 0 deletions src/Bee.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "Bee.h"

Bee::Bee(SDL_Texture* texture, short base)
{
switch (base)
{
case 0:
posX = 19;
break;
case 1:
posX = 177;
break;
case 2:
posX = 336;
break;
case 3:
posX = 494;
break;
case 4:
posX = 652;
break;
}
posY = 138;
this->texture = texture;
this->base = base;
}

void Bee::show(Draw* draw)
{
SDL_Rect rect;
rect.x = 0;
rect.y = 0;
rect.w = 49;
rect.h = 39;
draw->drawPartOfTexture(draw->renderer, texture, posX, posY, rect, 0, SDL_FLIP_NONE);
}
14 changes: 14 additions & 0 deletions src/Bee.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "Entity.h"

class Bee: public Entity
{
SDL_Texture* texture;
public:
short base;

Bee(SDL_Texture* texture, short base);
void show(Draw* draw);
};

28 changes: 23 additions & 5 deletions src/Car.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ Car::Car(SDL_Texture* carsTexture, int car_type, int posX, int posY, int velocit
case 0:
this->carRect.x = 0;
this->carRect.w = 26;
this->carRect.h = 32;
this->carRect.h = 34;
break;
case 1:
this->carRect.x = 26;
this->carRect.x = 52;
this->carRect.w = 50;
this->carRect.h = 28;
break;
case 2:
this->carRect.x = 76;
this->carRect.x = 102;
this->carRect.w = 27;
this->carRect.h = 28;
break;
case 3:
this->carRect.x = 103;
this->carRect.x = 129;
this->carRect.w = 30;
this->carRect.h = 40;
break;
default:
this->carRect.x = 133;
this->carRect.x = 159;
this->carRect.w = 29;
this->carRect.h = 40;
break;
Expand All @@ -43,6 +43,7 @@ Car::Car(SDL_Texture* carsTexture, int car_type, int posX, int posY, int velocit

this->direction = direction;
this->velocity = velocity;
last_animation_time = SDL_GetTicks();
}

void Car::show(Draw* draw)
Expand All @@ -52,6 +53,7 @@ void Car::show(Draw* draw)

void Car::move(int fps)
{
animate();
if(fps>0)
this->step = velocity * (1/(double)fps) + this->step;
if (this->step >= 1)
Expand All @@ -68,4 +70,20 @@ void Car::move(int fps)
this->step = 0;
}

}

void Car::animate()
{
if (SDL_GetTicks() - last_animation_time > 20000 / velocity)
{
if (carRect.x == 0)
carRect.x = 26;
else if (carRect.x == 26)
carRect.x = 0;
else if (carRect.x == 159)
carRect.x = 188;
else if (carRect.x == 188)
carRect.x = 159;
last_animation_time = SDL_GetTicks();
}
}
1 change: 1 addition & 0 deletions src/Car.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Car: public Entity
Car(SDL_Texture* carsTexture, int car_type, int posX, int posY, int velocity, direction_t direction);
void show(Draw* draw);
void move(int fps);
void animate();

};

17 changes: 0 additions & 17 deletions src/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,6 @@ bool Entity::collision(int frogX, int frogY, int frogWidth, int frogHeight)
int frogCenterX = frogX + frogWidth / 2;
int frogCenterY = frogY + frogHeight / 2;

//if (beetwen(this->posY + this->height / 2, frogY + frogHeight / 2, frogY - frogHeight / 2))
//{

// if (beetwen(this->posX + this->width / 2, frogX + frogWidth / 2, frogX - frogWidth / 2))
// return true;
// if (beetwen(this->posX - this->width / 2, frogX + frogWidth / 2, frogX - frogWidth / 2))
// return true;
//}

//if (beetwen(this->posY - this->height / 2, frogY + frogHeight / 2, frogY - frogHeight / 2))
//{
// if (beetwen(this->posX + this->width / 2, frogX + frogWidth / 2, frogX - frogWidth / 2))
// return true;
// if (beetwen(this->posX - this->width / 2, frogX + frogWidth / 2, frogX - frogWidth / 2))
// return true;
//}

if (beetwen(centerY + this->height / 2, frogCenterY + frogHeight / 2, frogCenterY - frogHeight / 2))
{
if (beetwen(centerX + this->width / 2, frogCenterX + frogWidth / 2, frogCenterX - frogWidth / 2))
Expand Down
1 change: 1 addition & 0 deletions src/Entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Entity
direction_t direction;
int velocity; //pixels every second
int posX, posY, width, height;
int last_animation_time;

bool collision(int frogX, int frogY, int frogWidth, int frogHeight);
bool centerCollision(int frogX, int frogY, int frogWidth, int frogHeight);
Expand Down
6 changes: 3 additions & 3 deletions src/Frog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Frog::Frog(SDL_Texture* texture)
{
error = false;
jump_distance = 53;
jump_velocity = 130;
jump_velocity = 1530;
direction = none;

frogTexture = texture;
Expand Down Expand Up @@ -60,7 +60,7 @@ void Frog::showFrog(Draw* draw)

void Frog::setAnimation()
{
if (SDL_GetTicks() - last_animation_time > 150)
if (SDL_GetTicks() - last_animation_time > 100)
{
if (animation_state == a_land)
animation_state = a_stand;
Expand All @@ -75,7 +75,7 @@ void Frog::setAnimation()

void Frog::jump(SDL_Keycode key)
{
if (!jumping && SDL_GetTicks() - last_time_jumped > 200 && moveable)
if (!jumping && SDL_GetTicks() - last_time_jumped > 100 && moveable)
{
if (direction != none)
{
Expand Down
2 changes: 0 additions & 2 deletions src/Frog.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class Frog: public Entity
{
frog_animation animation_state;

int last_animation_time;

int last_time_jumped;

double step, current_steps;
Expand Down
Loading

0 comments on commit bca0c31

Please sign in to comment.