Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #1

Open
wants to merge 240 commits into
base: feedback
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
240 commits
Select commit Hold shift + click to select a range
0fdf4a3
Setting up GitHub Classroom Feedback
github-classroom[bot] Jun 11, 2022
350c490
Create README.md
DNDonchev20 Jun 11, 2022
5cd1676
Add files
DNDonchev20 Jun 11, 2022
bf2ba8a
Make moving character and add border logic
DNDonchev20 Jun 12, 2022
43e2791
Remove unnecessary header file and .gitkeep
DNDonchev20 Jun 12, 2022
251ff4a
Fix ground position and the starting position
DNDonchev20 Jun 12, 2022
5f5dcb5
Rewrite movement checks and add diagonal movement
DNDonchev20 Jun 12, 2022
700ed65
Move header files and set up class for variables
DNDonchev20 Jun 12, 2022
9ac490c
fixed error for window
ISBachvarov21 Jun 13, 2022
9bcbd49
centered player
ISBachvarov21 Jun 13, 2022
ddcb4ad
Create classes for game and npc/player. Optimize
ISBachvarov21 Jun 14, 2022
d458aac
Update main.cpp
ISBachvarov21 Jun 14, 2022
518d0fd
Minor changes
ISBachvarov21 Jun 14, 2022
617a08b
Add necessary files
ISBachvarov21 Jun 14, 2022
ce8f6c0
Fix file errors
DNDonchev20 Jun 14, 2022
9663457
Fix character moving bug
DNDonchev20 Jun 14, 2022
8df591a
Add images folder
DNDonchev20 Jun 14, 2022
85c853f
Revert to working version
ISBachvarov21 Jun 14, 2022
298e34d
Move functions out of main file
DNDonchev20 Jun 15, 2022
4d45979
Create main game character
ASStaykova19 Jun 15, 2022
6e502a5
Create main character left walking
ASStaykova19 Jun 15, 2022
ed5a79b
Create main character right walking
ASStaykova19 Jun 15, 2022
5f8f842
Create main character jumping
ASStaykova19 Jun 15, 2022
1aaec51
Add fonts
DNDonchev20 Jun 16, 2022
fe0a671
Add simple anims
ISBachvarov21 Jun 16, 2022
85b4d72
Add bg & fix player class
ISBachvarov21 Jun 16, 2022
e95a18e
Create character jumping left
ASStaykova19 Jun 16, 2022
3e2bb47
Change folders
ASStaykova19 Jun 16, 2022
6b9edd7
Make changes on main character
ASStaykova19 Jun 16, 2022
1232e8f
Combine sheets into 1
ISBachvarov21 Jun 16, 2022
816307b
Modify player class & add animations
ISBachvarov21 Jun 16, 2022
b9938f1
Fix camera movement
ISBachvarov21 Jun 16, 2022
b76e6f7
Update README.md
ISBachvarov21 Jun 16, 2022
e87220c
Add animation when character moving (moonwalk???)
ISBachvarov21 Jun 17, 2022
acb7d8f
Revert "Add animation when character moving (moonwalk???)"
ISBachvarov21 Jun 17, 2022
6e23659
Add moving animation
ISBachvarov21 Jun 17, 2022
aeb0fbc
Fix wide char
ISBachvarov21 Jun 17, 2022
7973bdc
Sync bg image and character. Fix borders
ISBachvarov21 Jun 17, 2022
1ec9ced
Minor changes
ISBachvarov21 Jun 17, 2022
bf4d830
Add menu background
SDIvanov21 Jun 17, 2022
707355b
Create Main Character still sheet.png #20
SMTashev20 Jun 17, 2022
f9831ed
Create menu
ISBachvarov21 Jun 17, 2022
3467c7c
Center character and optimize menu
ISBachvarov21 Jun 17, 2022
df6970b
Reorganize files
ISBachvarov21 Jun 17, 2022
7f1f47a
Change the sprite sheet
SMTashev20 Jun 17, 2022
85f38ab
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
SMTashev20 Jun 17, 2022
8a5b0ee
Switch to animations when character is not moving
DNDonchev20 Jun 17, 2022
178f84f
Add jump mechanic
ISBachvarov21 Jun 17, 2022
e0ccf7f
Fix jump mechanic
ISBachvarov21 Jun 18, 2022
dc04e84
Add ground and collision detection
ISBachvarov21 Jun 18, 2022
fa049a5
Minor changes
DNDonchev20 Jun 18, 2022
5e61d41
Separate one function in two
DNDonchev20 Jun 18, 2022
b09af5c
Add main menu music
ISBachvarov21 Jun 18, 2022
f255ba0
Add sounds
ISBachvarov21 Jun 18, 2022
d20edd4
Fix sounds and add toggle for WS movement
ISBachvarov21 Jun 18, 2022
4577a26
Fix moving at y - axis
DNDonchev20 Jun 18, 2022
8c970a3
Add fps counter
ISBachvarov21 Jun 18, 2022
2ee83b6
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
ISBachvarov21 Jun 18, 2022
f49cc2e
Add example icon
DNDonchev20 Jun 19, 2022
fd82825
Fix function names in header file
DNDonchev20 Jun 19, 2022
68ab8c7
Add audio toggle
ISBachvarov21 Jun 19, 2022
c559e14
Add ramp
DNDonchev20 Jun 19, 2022
5e5b73b
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
DNDonchev20 Jun 19, 2022
35f57dc
Add ramp
ISBachvarov21 Jun 19, 2022
9b96f24
Add options menu frame
SDIvanov21 Jun 19, 2022
58c451e
Setup the folders for the website
ZZSpasov20 Jun 20, 2022
08e7bf6
Fix ramp collision(partiaully)
DNDonchev20 Jun 22, 2022
7587dbb
Fix camera and character movement
DNDonchev20 Jun 22, 2022
be0f369
Upload map1.0
ASStaykova19 Jun 22, 2022
595abc3
Fix ground collision
DNDonchev20 Jun 23, 2022
43b0f7f
Remove useless functions
DNDonchev20 Jun 23, 2022
d170561
Overwrite collision block with stage two bg
DNDonchev20 Jun 23, 2022
d9b3949
Create part 2 background
ASStaykova19 Jun 23, 2022
562ee5d
Update README.md
DNDonchev20 Jun 23, 2022
f3f919d
Fix movement for stage 2
DNDonchev20 Jun 23, 2022
3a3c328
Fix x axis movement
DNDonchev20 Jun 23, 2022
ec1857f
Fix camera lock
DNDonchev20 Jun 23, 2022
9152ee1
Fix camera movement
DNDonchev20 Jun 23, 2022
4bbf49c
Fix player movement
DNDonchev20 Jun 23, 2022
f905c5c
Fix x axis center
DNDonchev20 Jun 23, 2022
26aff90
Fix borders amd increase speed
DNDonchev20 Jun 23, 2022
e35d035
Make ramp collision
DNDonchev20 Jun 23, 2022
f4f2ebc
Fix mages movement when bg is moving
DNDonchev20 Jun 23, 2022
d20d671
Fix ramp collision
DNDonchev20 Jun 23, 2022
a1af241
Make bool function return 37
DNDonchev20 Jun 23, 2022
d4c6786
Minor changes
DNDonchev20 Jun 23, 2022
6033b40
Upload spawn photo
ASStaykova19 Jun 24, 2022
155f85c
Make music loop
DNDonchev20 Jun 24, 2022
d9a3efe
Blue
ASStaykova19 Jun 24, 2022
2da3f25
Make message emote disappear/appear
DNDonchev20 Jun 24, 2022
fc6ee78
Update README.md
MVVelkov21 Jun 24, 2022
cf58273
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
MVVelkov21 Jun 24, 2022
ab2fb45
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
ASStaykova19 Jun 24, 2022
ab75be4
Make enemy npc
ASStaykova19 Jun 24, 2022
fb051e0
Update README.md
DNDonchev20 Jun 24, 2022
3634d50
Update README.md
ISBachvarov21 Jun 24, 2022
4291b86
Fix jump power and make class for collision blocks
DNDonchev20 Jun 24, 2022
c7c36d4
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
DNDonchev20 Jun 24, 2022
656b8ee
Add block for making collision
DNDonchev20 Jun 24, 2022
e1ffe88
Add custom fonts and make the nav
ZZSpasov20 Jun 24, 2022
66631a4
Fix collision block position
DNDonchev20 Jun 24, 2022
7983b39
Add files via upload
MVVelkov21 Jun 24, 2022
ca1f304
Changes (inspired by SMToshev23)
ISBachvarov21 Jun 24, 2022
2c62116
Fix Block class
ISBachvarov21 Jun 24, 2022
10ebf65
Add collision for blocks
ISBachvarov21 Jun 24, 2022
1b7b79c
Finish home section
ZZSpasov20 Jun 24, 2022
5cf02f6
Finish features section
ZZSpasov20 Jun 24, 2022
5c3275d
Minor changes
ISBachvarov21 Jun 24, 2022
5328143
Add option menu
DNDonchev20 Jun 24, 2022
8072f21
Finish sponsor section
ZZSpasov20 Jun 24, 2022
fdbc59d
Make npc class
ISBachvarov21 Jun 24, 2022
cc02c88
Add option menu
DNDonchev20 Jun 25, 2022
aa810fd
Fix updateMovement linking variables
DNDonchev20 Jun 25, 2022
4e6585b
Fix character random jumping out of the map
DNDonchev20 Jun 25, 2022
0f47b90
Add options menu and check
SDIvanov21 Jun 25, 2022
8ce8806
Finsh option menu
DNDonchev20 Jun 25, 2022
e9f2c36
Add the new function in Menu.h
DNDonchev20 Jun 25, 2022
c185f65
Fix show fps option
DNDonchev20 Jun 25, 2022
88ba83a
Fix game not closing when it's in the menu
DNDonchev20 Jun 25, 2022
1be69c0
Make npc demo
ISBachvarov21 Jun 25, 2022
119cb0a
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
ISBachvarov21 Jun 25, 2022
d465237
Fix audio volume
DNDonchev20 Jun 25, 2022
c50c87c
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
DNDonchev20 Jun 25, 2022
82c2a4b
Link Menu.h file to Eloctavo-Functions.cpp
DNDonchev20 Jun 25, 2022
b8d3d72
Make npc have delay
ISBachvarov21 Jun 25, 2022
0856959
Finish the footer
ZZSpasov20 Jun 25, 2022
aa90e42
Add a backstory frame
SDIvanov21 Jun 25, 2022
ec8f2be
Add animationText()
DNDonchev20 Jun 25, 2022
49ed133
Try to fix ramp collision
ISBachvarov21 Jun 25, 2022
68d3c2d
Finish news section
ZZSpasov20 Jun 25, 2022
63fc8cc
Make the features section responsive to 1200px
ZZSpasov20 Jun 25, 2022
c752382
Make news section responsive to 1200px
ZZSpasov20 Jun 25, 2022
2ef7872
Make home section responsive to 993px
ZZSpasov20 Jun 25, 2022
7cf1142
Make features section responsive to 993px
ZZSpasov20 Jun 25, 2022
2a6bdf5
Make footer responsive to 993px
ZZSpasov20 Jun 25, 2022
4356bae
Make home section responsive to 768px
ZZSpasov20 Jun 25, 2022
8f2ebe2
Make news section responsive to 768px
ZZSpasov20 Jun 25, 2022
daa4f1b
Make sponsor section responsive to 768px
ZZSpasov20 Jun 25, 2022
6698af5
Fix npc walk anim
ISBachvarov21 Jun 25, 2022
7fed6bd
Add new icon
ISBachvarov21 Jun 25, 2022
3906e1b
Add hypotenuse ramp collision
ISBachvarov21 Jun 25, 2022
cb26f9e
Minor changes
ISBachvarov21 Jun 25, 2022
985cbc8
Make the nav and home section responsive to 576px
ZZSpasov20 Jun 26, 2022
0d1bc13
Make features section responsive to 576px
ZZSpasov20 Jun 26, 2022
89a1e6d
Finish the redponsive responsive to 576px
ZZSpasov20 Jun 26, 2022
2da9c86
Make the nav and home section responsive below 576px
ZZSpasov20 Jun 26, 2022
0a06d4e
Make home section responsive below 576px
ZZSpasov20 Jun 26, 2022
96114d1
Finish the responsive below 576px
ZZSpasov20 Jun 26, 2022
2d9d070
Add backstory and text animation effect
DNDonchev20 Jun 26, 2022
def1e08
Create news page
ZZSpasov20 Jun 26, 2022
98b4140
Add hardware requirements
DNDonchev20 Jun 26, 2022
3a9e3e5
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
DNDonchev20 Jun 26, 2022
0acd098
Add footer in the news page
ZZSpasov20 Jun 26, 2022
646d0f7
Add setup function into main
DNDonchev20 Jun 26, 2022
b2c80e8
Start the login form
ZZSpasov20 Jun 26, 2022
38d83d6
Finish the login form
ZZSpasov20 Jun 26, 2022
78e131a
Finish the log in page responsives
ZZSpasov20 Jun 26, 2022
26f2e56
Update README.md
SMTashev20 Jun 26, 2022
cd226c5
Fix ramp
ISBachvarov21 Jun 26, 2022
93adeeb
Add backstory
DNDonchev20 Jun 26, 2022
3fa8248
Delete merge conflict description
DNDonchev20 Jun 26, 2022
594bf64
Add writing audio
DNDonchev20 Jun 26, 2022
e635836
Add check for playing the audio
DNDonchev20 Jun 26, 2022
b86095f
Add touch backstory options
DNDonchev20 Jun 26, 2022
55ce471
Make checking variables from int to bool
DNDonchev20 Jun 26, 2022
6567651
Change game icon
DNDonchev20 Jun 26, 2022
4bd7c0d
Add dialogue bubbles and a heart icon
SDIvanov21 Jun 26, 2022
9d6c62d
Finish map
ASStaykova19 Jun 26, 2022
44ce64b
Finish map
ASStaykova19 Jun 26, 2022
14858cb
Update map spikes
ASStaykova19 Jun 26, 2022
6140b00
Add cutscene
DNDonchev20 Jun 26, 2022
c8a45a3
Fix map not rendering
DNDonchev20 Jun 26, 2022
3cd9328
Fix cutscene
DNDonchev20 Jun 26, 2022
3d0c53f
Finish cutscene
DNDonchev20 Jun 26, 2022
281ca9b
Make npc aggro and kill
ISBachvarov21 Jun 26, 2022
ccd4bac
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
ISBachvarov21 Jun 26, 2022
a5fd668
Fix variables
ISBachvarov21 Jun 26, 2022
3670f84
Fix spelling mistake made by SMToshev20
ISBachvarov21 Jun 26, 2022
8cabdc8
Add map continue
ASStaykova19 Jun 26, 2022
a5f4be7
Final touches on feedback page
ZZSpasov20 Jun 26, 2022
1cfed63
Add images in the features section
ZZSpasov20 Jun 26, 2022
66bd882
Create about us page
ZZSpasov20 Jun 26, 2022
e850e97
Create logo
ASStaykova19 Jun 26, 2022
bd1c1fa
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
ASStaykova19 Jun 26, 2022
1723c05
Add collision detection for platforms
ISBachvarov21 Jun 26, 2022
2ec275c
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
ISBachvarov21 Jun 26, 2022
35a8715
Make about us responsive to 576px
ZZSpasov20 Jun 26, 2022
0e2a090
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
ZZSpasov20 Jun 26, 2022
2077032
Add Documentation file.
SMTashev20 Jun 26, 2022
e43dae4
Upload Nestashev
ASStaykova19 Jun 26, 2022
768af9b
Add Nestashev to map
ASStaykova19 Jun 26, 2022
9fca187
Add different versions of the logo
ASStaykova19 Jun 26, 2022
91b6a97
Finish the about us page
ZZSpasov20 Jun 26, 2022
419b0af
Make right border
ISBachvarov21 Jun 26, 2022
e6a6da2
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
ISBachvarov21 Jun 26, 2022
c6d1c6d
Add a dialogue bubble for Nestashev
SDIvanov21 Jun 26, 2022
f2f0ab0
Fix ramp collision
ISBachvarov21 Jun 26, 2022
4863d40
Fix images bug
ZZSpasov20 Jun 26, 2022
d6f4b1f
Fix ground collision
ISBachvarov21 Jun 26, 2022
71d6ef1
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
ISBachvarov21 Jun 26, 2022
3e17b6f
Update README.md
SMTashev20 Jun 26, 2022
079c153
Fix npc
ISBachvarov21 Jun 26, 2022
307f71f
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
ISBachvarov21 Jun 26, 2022
82a874f
Update README.md
SMTashev20 Jun 26, 2022
553137a
Add final npc dialogue
ISBachvarov21 Jun 26, 2022
1f21edd
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
ISBachvarov21 Jun 26, 2022
5a45154
Create LICENSE.md
ASStaykova19 Jun 26, 2022
f13325c
Fix collision
ISBachvarov21 Jun 26, 2022
2702662
Add end
ISBachvarov21 Jun 26, 2022
50a7da9
Final changes
DNDonchev20 Jun 27, 2022
70a680d
Add comments
DNDonchev20 Jun 27, 2022
1bb0aeb
Hide the console
DNDonchev20 Jun 27, 2022
b4c4d02
Remove comments
DNDonchev20 Jun 27, 2022
bd9fd98
Add new end panel
DNDonchev20 Jun 27, 2022
b80811e
Add audio when character is tlking with the npcs
DNDonchev20 Jun 27, 2022
e787cb7
Fix talking audio bug when end panel is open
DNDonchev20 Jun 27, 2022
7c61bed
Update README.md
SMTashev20 Jun 27, 2022
a7fffec
Fix second ramp collision
DNDonchev20 Jun 27, 2022
5a355fe
Merge branch 'main' of https://github.com/codingburgas/2122-finalProj…
DNDonchev20 Jun 27, 2022
16f32e0
Update README.md
ASStaykova19 Jun 27, 2022
6b65aab
Update README.md
ASStaykova19 Jun 27, 2022
2d232a2
Fix first ramp collision
DNDonchev20 Jun 27, 2022
32e71d9
Fix README.md
ASStaykova19 Jun 27, 2022
bb273ce
Minor changes
DNDonchev20 Jun 27, 2022
268c13b
Add second npc
DNDonchev20 Jun 27, 2022
592ebab
Hide the console
DNDonchev20 Jun 27, 2022
c0d487e
Fix sprite sheet
ASStaykova19 Jun 27, 2022
8689492
Fix talk audio for first dialogue
DNDonchev20 Jun 28, 2022
0dc9f57
Fix camera moving when final border is reached
DNDonchev20 Jun 28, 2022
03cb1fb
Fix npc position when respawn
DNDonchev20 Jun 28, 2022
8131e21
Fix ramp showing when respawn
DNDonchev20 Jun 28, 2022
42fb608
Fix npc bug
DNDonchev20 Jun 28, 2022
936eb91
Fix block collision
DNDonchev20 Jun 28, 2022
05bec4f
Make character not moving during dialogue
DNDonchev20 Jun 28, 2022
2c56863
Fix game ending
DNDonchev20 Jun 28, 2022
0f86f6e
Add close confirmation
ISBachvarov21 Jun 28, 2022
147119f
Add presentation to README.md
ASStaykova19 Jun 28, 2022
bba2cfd
Hide console
ISBachvarov21 Jun 28, 2022
6e14756
Fix bugs
DNDonchev20 Jul 6, 2022
628eeee
Add end panel everywhere in the game
DNDonchev20 Jul 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Modify player class & add animations
Co-Authored-By: Deivid Donchev <85338879+DNDonchev20@users.noreply.github.com>
  • Loading branch information
ISBachvarov21 and DNDonchev20 committed Jun 16, 2022
commit 816307be27b7a55dcd6be424a544d3051b9f9ac9
191 changes: 98 additions & 93 deletions Program/Game/El Octavo-Functions.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
#include "Precompile.h"
#include "El Octavo-Functions.h";

#include "GameClass.h";

namespace variables {
int keyTime = 0;
float deltaTime = 0.0f;

RenderWindow window(VideoMode(1500, 800), "The legend of Kurabirov", sf::Style::Titlebar | sf::Style::Close);;
Event ev;

Texture bgTexture;
Sprite bgImage;
Player plr;

Texture plrT;
Sprite plrS;
Sprite plrRect;

}

using namespace variables;

void update(int& keyTime, RectangleShape& square, RenderWindow& window);
//void update(int& keyTime, RectangleShape& square, RenderWindow& window);
void moveCamera(string direction, Sprite& image);

void setVars()
@@ -27,105 +32,31 @@ void setVars()
bgTexture.loadFromFile("../Images and fonts/Bg/test bg.png");
bgImage.setTexture(bgTexture);

plrT.loadFromFile("../Images and fonts/Main character/Main Character 81x129.png");
plrS.setTexture(plrT);


plr.setPublicVariables(window.getSize().x / 2, window.getSize().y / 2, 100, plrS);
plr.setValues();

plrRect.setTexture(plrT);
plrRect.setPosition(window.getSize().x / 2, window.getSize().y / 2);
plrT.loadFromFile("../Images and fonts/Main character/Main character walking sheet.png");

//setting position of the background
bgImage.setOrigin(1920, 1080);
bgImage.setPosition(window.getSize().x / 2, window.getSize().y / 2);

}

void moveCamera(string direction, Sprite& image) {
if (direction == "left" && image.getPosition().x != 1920)
{
image.move(5.f, 0.f);
}

if (direction == "right" && image.getPosition().x != -420)
{
image.move(-5.f, 0.f);
}

if (direction == "up")
{
if (image.getPosition().y != 1080) {
image.move(0.f, 5.f);
}
else {
if (!plr.getMoved()) {
plr.updatePos(0.f, 5.f);

if (plr.getPos('y') >= ) {

}
}
}
}


if (direction == "down" && image.getPosition().y != -280)
{
image.move(0.f, -5.f);
}
}

void update(int& keyTime, RectangleShape& square, RenderWindow& window)
void setup()
{
if (keyTime < 1)
{
keyTime++;
}

//WASD moving
if (keyTime >= 1)
{
if (Keyboard::isKeyPressed(Keyboard::A))
{
moveCamera("left", bgImage);
keyTime = 0;
}

if (Keyboard::isKeyPressed(Keyboard::D))
{
moveCamera("right", bgImage);
keyTime = 0;
}

if (Keyboard::isKeyPressed(Keyboard::W))
{
moveCamera("up", bgImage);
keyTime = 0;
}
setVars();

if (Keyboard::isKeyPressed(Keyboard::S))
{
moveCamera("down", bgImage);
keyTime = 0;
}
// start of sussy variables

if (Mouse::isButtonPressed(Mouse::Left))
{
square.setFillColor(Color::Blue);
keyTime = 0;
}
else {
square.setFillColor(Color::Red);
keyTime = 0;
}
}
}
Clock clock;
Player plr(&plrT, Vector2u(3, 2), 0.3f);


void setup()
{
setVars();
// end of sussy variables

while (window.isOpen())
{
deltaTime = clock.restart().asSeconds();

while (window.pollEvent(ev))
{
if (ev.type == Event::Closed)
@@ -139,13 +70,87 @@ void setup()
}
}

//cout << plrRect.getPosition().x << " " << plrRect.getPosition().y << endl;

plr.update(0, deltaTime);
plrRect.setTextureRect(plr.uvRect);

window.clear(Color::Green);

window.draw(bgImage);
//window.draw(bgImage);
window.draw(plrRect);

//display character
plr.draw(window);

window.display();
}
}
}

void moveCamera(string direction, Sprite& image) {
if (direction == "left" && image.getPosition().x != 1920)
{
image.move(5.f, 0.f);
}

if (direction == "right" && image.getPosition().x != -420)
{
image.move(-5.f, 0.f);
}

if (direction == "up" && image.getPosition().y != 1080)
{
image.move(0.f, 5.f);
}


if (direction == "down" && image.getPosition().y != -280)
{
image.move(0.f, -5.f);
}
}

//void update(int& keyTime, RectangleShape& square, RenderWindow& window)
//{
// if (keyTime < 1)
// {
// keyTime++;
// }
//
// //WASD moving
// if (keyTime >= 1)
// {
// if (Keyboard::isKeyPressed(Keyboard::A))
// {
// moveCamera("left", bgImage);
// keyTime = 0;
// }
//
// if (Keyboard::isKeyPressed(Keyboard::D))
// {
// moveCamera("right", bgImage);
// keyTime = 0;
// }
//
// if (Keyboard::isKeyPressed(Keyboard::W))
// {
// moveCamera("up", bgImage);
// keyTime = 0;
// }
//
// if (Keyboard::isKeyPressed(Keyboard::S))
// {
// moveCamera("down", bgImage);
// keyTime = 0;
// }
//
// if (Mouse::isButtonPressed(Mouse::Left))
// {
// square.setFillColor(Color::Blue);
// keyTime = 0;
// }
// else {
// square.setFillColor(Color::Red);
// keyTime = 0;
// }
// }
//}
1 change: 1 addition & 0 deletions Program/Game/Game.vcxproj
Original file line number Diff line number Diff line change
@@ -146,6 +146,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="El Octavo-Functions.cpp" />
<ClCompile Include="GameClass.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="Menu.cpp" />
</ItemGroup>
3 changes: 3 additions & 0 deletions Program/Game/Game.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -24,6 +24,9 @@
<ClCompile Include="El Octavo-Functions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GameClass.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GameClass.h">
38 changes: 38 additions & 0 deletions Program/Game/GameClass.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "GameClass.h";

Player::Player(Texture* texture, Vector2u imageCount, float switchTime)
{
this->imageCount = imageCount;
this->switchTime = switchTime;

totalTime = 0.0f;

currentImage.x = 0;

uvRect.width = texture->getSize().x / float(imageCount.x);
uvRect.height = texture->getSize().y / float(imageCount.y);
}

Player::~Player()
{
}

void Player::update(int row, float deltaTime)
{
currentImage.y = row;
totalTime += deltaTime;

if(totalTime >= switchTime)
{
totalTime -= switchTime;
currentImage.x++;

if(currentImage.x >= imageCount.x)
{
currentImage.x = 0;
}
}

uvRect.left = currentImage.x * uvRect.width;
uvRect.top = currentImage.y * uvRect.height;
}
33 changes: 11 additions & 22 deletions Program/Game/GameClass.h
Original file line number Diff line number Diff line change
@@ -11,23 +11,27 @@ class Player {
int hp;
int pSC;
bool pMoved;
Sprite pSprite;
float totalTime;
float switchTime;
Vector2u imageCount;
Vector2u currentImage;

public:
IntRect uvRect;

void setPublicVariables(float posX, float posY, int hp, Sprite pSprite)
Player(Texture* texture, Vector2u imageCount, float switchTime);
~Player();

void update(int row, float deltaTime);

void setPublicVariables(float posX, float posY, int hp)
{
this->posX = posX;
this->posY = posY;
this->hp = hp;
this->pSprite = pSprite;
this->pMoved = false;
}

void setValues()
{
this->pSprite.setPosition(this->posX, this->posY);
}
// misc functions

float getPos(char cord) {
@@ -46,25 +50,10 @@ class Player {

// update functions

void updatePos(float moveX, float moveY) {
this->pSprite.move(moveX, moveY);

this->posX = pSprite.getPosition().x;
this->posY = pSprite.getPosition().y;
}

void changeSprite(Texture* newTexture) {
this->pSprite.setTexture(*newTexture);
}

void updateHealth(int newHp) {
this->hp = newHp;
}

void draw(RenderWindow& window) {
window.draw(pSprite);
}


// combat functions