Skip to content

Commit d9ba8b0

Browse files
committed
fuel mechanic, crowded space, some assets deleted
- moon gravity increased - some window info deleted
1 parent 4092c4e commit d9ba8b0

8 files changed

Lines changed: 78 additions & 11 deletions

File tree

Aprending_Team/Game/Source/App.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ void App::FinishUpdate()
228228
}
229229

230230
static char title[256];
231-
sprintf_s(title, 256, "Av.FPS: %.2f Last Frame Ms: %02u Last sec frames: %i Last dt: %.3f Time since startup: %.3f Frame Count: %I64u cameraY %d player y%d angle: %d addForceX: %d addForceY: %d",
232-
averageFps, lastFrameMs, framesOnLastSecond, dt, secondsSinceStartup, frameCount, app->render->camera.y, app->player->position.y, app->player->angle, app->player->addForceX, app->player->addForceY);
231+
sprintf_s(title, 256, "Av.FPS: %.2f Last Frame Ms: %02u Last sec frames: %i Last dt: %.3f Time since startup: %.3f Frame Count: %I64u",
232+
averageFps, lastFrameMs, framesOnLastSecond, dt, secondsSinceStartup, frameCount);
233233

234234
app->win->SetTitle(title);
235235

Aprending_Team/Game/Source/AprendingTeam.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class PhysicsEngine
1515
void MRUA(Body* body, float dt);
1616

1717
private:
18-
int gravityMoon = 2;
18+
int gravityMoon = 3;
1919
int gravityEarth = 10;
2020
int earthRange = -2000;
2121
int moonRange = -4000;

Aprending_Team/Game/Source/Player.cpp

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ bool Player::Start()
3838
winTex = app->tex->Load("Assets/Textures/win.png");
3939
bombTex = app->tex->Load("Assets/Textures/bomb.png");
4040
loseTex = app->tex->Load("Assets/Textures/lose.png");
41+
pl1Tex = app->tex->Load("Assets/Textures/planet1.png");
42+
pl2Tex = app->tex->Load("Assets/Textures/planet2.png");
4143
oceanTex = app->tex->Load("Assets/Textures/ocean.png");
4244
cloudTex = app->tex->Load("Assets/Textures/clouds.png");
45+
fuelTex = app->tex->Load("Assets/Textures/fuel.png");
4346
fxWin = app->audio->PlayMusic("Assets/Audio/Hymn.wav");
4447
app->fxList.Add(&fxWin);
4548

@@ -101,13 +104,20 @@ bool Player::PreUpdate()
101104

102105
fire = true;
103106
landed = false;
107+
108+
109+
if (fuelC < 750)
110+
{
111+
fuelC++;
112+
}
113+
if (fuelC == 750)
114+
{
115+
fuelC = 0;
116+
fuel--;
117+
}
104118
}
105119
else if (acc > 0)acc -= 0.05;
106120

107-
if (app->input->GetKey(SDL_SCANCODE_P) == KEY_REPEAT)
108-
{
109-
ship->position.y += 5;
110-
}
111121

112122
if (landed == false)
113123
{
@@ -141,7 +151,12 @@ bool Player::PreUpdate()
141151
}
142152

143153
//meteor harcoded hitbox (as all hitboxes will be cuz idk any other way rn)
144-
//if (ship->position.x < 50 + 58 && ship->position.x + 55 > 50 && ship->position.y < 50 + 58 && ship->position.y + 175 > 50) alive = false;
154+
155+
if (ship->position.x < 250 + 58 && ship->position.x + 55 > 250 && ship->position.y < -2500 + 58 && ship->position.y + 175 > -2500) alive = false;
156+
157+
if (ship->position.x < 570 + 58 && ship->position.x + 55 > 570 && ship->position.y < -3550 + 58 && ship->position.y + 175 > -3550) alive = false;
158+
159+
if (ship->position.x < 700 + 58 && ship->position.x + 55 > 700 && ship->position.y < -4100 + 58 && ship->position.y + 175 > -4100) alive = false;
145160

146161
//No you cant go to the center of the earth Verne
147162
if (ship->position.y > 70 && angle > 355 && ship->velocity.y < 3.0f && ship->velocity.x < 3.0f || ship->position.y > 70 && angle < 5 && velocity < 100 && ship->velocity.y < 5.0f && ship->velocity.x < 5.0f)
@@ -153,6 +168,8 @@ bool Player::PreUpdate()
153168
}
154169
else if(ship->position.y > 75 ) alive = false;
155170

171+
if (fuel == 0)alive = false;
172+
156173
if (ship->position.y == 70 && alive == true && bomb == true)
157174
{
158175
win = true;
@@ -179,13 +196,16 @@ bool Player::PreUpdate()
179196
//enter to revive (as in real life)
180197
if (app->input->GetKey(SDL_SCANCODE_RETURN) == KEY_DOWN)
181198
{
199+
win = false;
182200
alive = true;
183201
ship->SetPosition(startingPos);
184202
angle = 0;
185203
acc = 0;
186204
bomb = false;
187205
ship->velocity.x = 0.0f;
188206
ship->velocity.y = 0.0f;
207+
fuel = 4;
208+
fuelC = 0;
189209
}
190210
return true;
191211
}
@@ -212,13 +232,27 @@ bool Player::Update(float dt)
212232

213233
bool Player::PostUpdate()
214234
{
235+
236+
SDL_Rect pl1Rec = { 0, 0, 884, 884 };
237+
app->render->DrawTexture(pl1Tex, 800, -2600, &pl1Rec);
238+
239+
SDL_Rect pl2Rec = { 0, 0, 884, 884 };
240+
app->render->DrawTexture(pl2Tex, -200, -3800, &pl2Rec);
241+
215242
app->audio->PlayFx(fxWin);
216243
//meteor texture
217244
Animation* meteor = &meteorAnim;
218245
meteor->Update();
219246

220247
SDL_Rect meteorRec = meteor->GetCurrentFrame();
221-
app->render->DrawTexture(meteorTex, 50, 50, &meteorRec);
248+
app->render->DrawTexture(meteorTex, 250, -2500, &meteorRec);
249+
250+
SDL_Rect meteorRec2 = meteor->GetCurrentFrame();
251+
app->render->DrawTexture(meteorTex, 570, -3550, &meteorRec2);
252+
253+
SDL_Rect meteorRec3 = meteor->GetCurrentFrame();
254+
app->render->DrawTexture(meteorTex, 700, -4100, &meteorRec3);
255+
222256

223257
//bomb print
224258
if (bomb == true)
@@ -227,6 +261,8 @@ bool Player::PostUpdate()
227261
app->render->DrawTexture(bombTex, bombPos, -5800, &bombRec);
228262
}
229263

264+
265+
230266
//ocean print
231267
/*if (bomb == true)
232268
{
@@ -260,12 +296,38 @@ bool Player::PostUpdate()
260296
}
261297

262298

263-
264299
SDL_Rect cloudRec = { 0, 0, 2360, 984 };
265300
app->render->DrawTexture(cloudTex, -500, -1500, &cloudRec);
266-
267301

302+
if (fuel == 4)
303+
{
304+
SDL_Rect fuelRec1 = { 0, 0, 46, 20 };
305+
app->render->DrawTexture(fuelTex, 0, -app->render->camera.y, &fuelRec1);
306+
}
307+
308+
if (fuel == 3)
309+
{
310+
SDL_Rect fuelRec2 = { 47, 0, 46, 20 };
311+
app->render->DrawTexture(fuelTex, 0, -app->render->camera.y, &fuelRec2);
312+
}
268313

314+
if (fuel == 2)
315+
{
316+
SDL_Rect fuelRec3 = { 94, 0, 46, 20 };
317+
app->render->DrawTexture(fuelTex, 0, -app->render->camera.y, &fuelRec3);
318+
}
319+
320+
if (fuel == 1)
321+
{
322+
SDL_Rect fuelRec4 = { 141, 0, 46, 20 };
323+
app->render->DrawTexture(fuelTex, 0, -app->render->camera.y, &fuelRec4);
324+
}
325+
326+
if (fuel == 0)
327+
{
328+
SDL_Rect fuelRec5 = { 188, 0, 46, 20 };
329+
app->render->DrawTexture(fuelTex, 0, -app->render->camera.y, &fuelRec5);
330+
}
269331
//lose screen print
270332
if (alive == false && explosionAnim.HasFinished() == true)
271333
{

Aprending_Team/Game/Source/Player.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class Player : public Module
5353
float addForceY;
5454
PhysicsEngine* motor;
5555
Body* ship;
56+
int fuel=4;
57+
int fuelC=0;
5658

5759
private:
5860

@@ -67,6 +69,9 @@ class Player : public Module
6769
SDL_Texture* bombTex;
6870
SDL_Texture* oceanTex;
6971
SDL_Texture* cloudTex;
72+
SDL_Texture* pl1Tex;
73+
SDL_Texture* pl2Tex;
74+
SDL_Texture* fuelTex;
7075
unsigned int fxWin;
7176
Animation explosionAnim;
7277
Animation meteorAnim;
-887 KB
Binary file not shown.
File renamed without changes.
File renamed without changes.
-424 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)