Skip to content

Commit

Permalink
player 1 and 2 spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
christt105 committed Apr 22, 2018
1 parent d55ef20 commit 6b9bc1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 2 additions & 3 deletions SDL_AndroDunos/ModulePlayer1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "ModuleAudio.h"
#include "ModuleFonts.h"
#include "SDL/include/SDL.h"

#include <stdio.h>

ModulePlayer1::ModulePlayer1()
Expand Down Expand Up @@ -70,7 +69,7 @@ bool ModulePlayer1::Start()


graphics = App->textures->Load("assets/Sprites/ships.png");
position.x = SCREEN_WIDTH / 3;
position.x = 0;
position.y = SCREEN_HEIGHT / 3;

destroyed = false;
Expand All @@ -80,7 +79,7 @@ bool ModulePlayer1::Start()
hp = 3;
font_score = App->fonts->Load("Assets/Fonts/font_score.png", "1234567890P", 1);
score = 0;

god_mode_die = true;
laser1 = App->audio->Loadfx("Assets/Audio/Laser_Shot_Type-1_(Main_Ships).wav");
laser2 = App->audio->Loadfx("Assets/Audio/Laser_Shot_Type-2_(Main_Ships).wav");
laser3 = App->audio->Loadfx("Assets/Audio/Laser_Shot_Type-3_(Main_Ships).wav");
Expand Down
9 changes: 6 additions & 3 deletions SDL_AndroDunos/ModulePlayer2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ bool ModulePlayer2::Start()
bool ret = true;
bool insert2 = false;
graphics = App->textures->Load("assets/Sprites/ships.png");
position.x = SCREEN_WIDTH / 3;
position.x = 0;
position.y = SCREEN_HEIGHT * 2 / 3;

init_time = SDL_GetTicks(); //Timer
Expand All @@ -77,7 +77,7 @@ bool ModulePlayer2::Start()
font_score = App->fonts->Load("Assets/Fonts/font_score.png", "1234567890P", 1);
score = 0;
powerup = 1;

god_mode_die = true;
laser1 = App->audio->Loadfx("Assets/Audio/Laser_Shot_Type-1_(Main_Ships).wav");
laser2 = App->audio->Loadfx("Assets/Audio/Laser_Shot_Type-2_(Main_Ships).wav");
laser3 = App->audio->Loadfx("Assets/Audio/Laser_Shot_Type-3_(Main_Ships).wav");
Expand Down Expand Up @@ -107,7 +107,10 @@ update_status ModulePlayer2::Update()
if (god_mode_die == true) {
if (current_time < 4000) {
player_col->type = COLLIDER_NONE;
if (position.x <= App->stage1->camera_limit.xi + 44)
position.x++;
}

else {
player_col->type = COLLIDER_PLAYER;
god_mode_die = false;
Expand Down Expand Up @@ -372,7 +375,7 @@ void ModulePlayer2::OnCollision(Collider* col1, Collider* col2)
god_mode_die = true;
state = CLEAR;
init_time = SDL_GetTicks();
position.x = 0;
position.x = App->stage1->camera_limit.xi;;
position.y = 71;
}
}
Expand Down

0 comments on commit 6b9bc1c

Please sign in to comment.