Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Game::OnRender(Context &ctx) {
- goname->DrawMyName(ctx);
- ReadyToStart(ctx);
- hero->Intersect(ctx);
- if (help->Lflag) {
- DeleteAwalls(ctx);
- help->Lflag = false;
- DrawingFourLines(ctx);
- }
- if (help->Uflag) {
- DeleteAwalls(ctx);
- help->Uflag = false;
- DrawingFourLines(ctx);
- }
- if (hero->intersectwith) {
- PlaySFX(ctx, "pick.wav");
- tabletss[0] = new Tablets(5 + rand() % 230, 5 + rand() % 125, 5,5);
- hero->intersectwith = false;
- }
- if (hero->isWin()) {
- StopMusic(ctx, "back.wav");
- StopSFX(ctx, "pick.wav");
- DrawClearScreen(ctx, PALETTE[0]);
- DrawSprite(ctx, id, 0, 0, 0, 0, GetDisplayWidth(ctx), GetDisplayHeight(ctx));
- ostringstream ost;
- ost << help->lvl;
- string aa = ost.str();
- Print(ctx, "Level " + aa + " Passed!", 45, 25, PALETTE[7], 2);
- Print(ctx, "Tap Space", 65, 45, PALETTE[7],2);
- Print(ctx, "To next LVL", 55, 65, PALETTE[7], 2);
- tabletss.clear();
- if (IsClicked(ctx, Button::KEY_SPACE)) {
- isGameRestarted = true;
- }
- awalls.clear();
- }
- if (hero->isGameover()) {
- StopMusic(ctx, "back.wav");
- DrawClearScreen(ctx, PALETTE[0]);
- DrawSprite(ctx, id, 0, 0, 0, 0, GetDisplayWidth(ctx), GetDisplayHeight(ctx));
- Print(ctx, "Game Over",GetDisplayHeight(ctx)/2,25,PALETTE[7],2);
- Print(ctx, "Press SPACE to Restart",67,60,PALETTE[7],1);
- ostringstream ost;
- ost << help->lvl;
- string aa = ost.str();
- Print(ctx,goname->sname + ", your Highest LVL is : " + aa,45,100,PALETTE[7],1);
- if (IsClicked(ctx, Button::KEY_SPACE)) {
- isGameRestarted = true;
- }
- if (IsClicked(ctx, Button::KEY_ESCAPE)) {
- hero->tr = true;
- srecord.push_back(new Record(help->lvl, goname->sname));
- }
- DeleteAwalls(ctx);
- tabletss.clear();
- }
- if (isGameRestarted) {
- if (hero->isGameover()) {
- help->needtocatch = 4;
- help->lvl = 0;
- }
- PlayMusic(ctx, "back.wav");
- StopSFX(ctx, "respawn.wav");
- help->lvl++;
- help->needtocatch++;
- delete(hero);
- hero = new Player(GetDisplayWidth(ctx)/2+10,GetDisplayHeight(ctx)/2, 6, 150, 150, nwalls, awalls,tabletss, help);
- DeleteTablets(ctx);
- tabletss[0] = new Tablets(5 + rand() % 250, 5 + rand() % 135, 5,5);
- awalls.clear();
- hero->win = false;
- hero->gameover = false;
- hero->startgame = true;
- DrawEnemy(ctx);
- isGameRestarted = false;
- }
- if (hero->tr) {
- PrintTable(ctx);
- if (IsClicked(ctx, Button::KEY_BACKSPACE)) {
- hero->tr = false;
- isGameRestarted = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement