/minild29

To get this branch, use:
bzr branch http://9ix.org/bzr/minild29

« back to all changes in this revision

Viewing changes to Dark.cpp

  • Committer: Josh C
  • Date: 2011-09-18 16:12:57 UTC
  • Revision ID: josh@9ix.org-20110918161257-zshzdmi0e62idum1
some more stalk logic

Show diffs side-by-side

added added

removed removed

Lines of Context:
331
331
    Level::LoadProject("project.xml");
332
332
    Level::Load("level.xml", this);
333
333
 
334
 
    HideSpawners();
335
 
    Spawn();
336
 
 
337
334
    std::list<Entity*> *walls = GetAllTag("wall");
338
335
    for (std::list<Entity*>::iterator i = walls->begin(); i != walls->end(); ++i)
339
336
      {
342
339
        e->SetCollider(new RectangleCollider(s.x * 64, s.y * 64));
343
340
      }
344
341
   
345
 
    Graphics::SetBackgroundColor(Color::green * 0.2f);
346
 
 
347
 
  }
348
 
 
349
 
  void DarkScene::HideSpawners()
350
 
  {
351
 
    std::list<Entity*> *spawners = GetAllTag("spawner");
352
 
    if (spawners == NULL) {printf("NO SPAWNERS!!!\n");}
353
 
    for (std::list<Entity*>::iterator i = spawners->begin(); i != spawners->end(); ++i)
354
 
      (*i)->isVisible = false;
355
 
  }
356
 
 
357
 
  void DarkScene::ShowSpawners()
358
 
  {
359
 
    std::list<Entity*> *spawners = GetAllTag("spawner");
360
 
    for (std::list<Entity*>::iterator i = spawners->begin(); i != spawners->end(); ++i)
361
 
      (*i)->isVisible = true;
362
 
  }
363
 
  
364
 
  void DarkScene::Spawn()
365
 
  {
366
 
    Entity* playersp = GetFirstEntityWithTag("playerspawner");
367
342
    player = new Player();
368
 
    player->position = playersp->position;;
 
343
    player->position = Graphics::GetScreenCenter();
369
344
    Add(player);
370
345
    Add(player->dark);
371
346
 
372
 
    std::list<Entity*> *spawners = GetAllTag("creaturespawner");
373
 
    // Ugh, monocle is double-entering all the tags...
374
 
    spawners->sort();
375
 
    spawners->unique();
376
 
    for (std::list<Entity*>::iterator i = spawners->begin(); i != spawners->end(); ++i)
377
 
      {
378
 
        Creature *creature = new Creature();
379
 
        creature->position = (*i)->position;
380
 
        Add(creature);
381
 
      }
 
347
    Creature *creature = new Creature;
 
348
    creature->position = Graphics::GetScreenCenter();
 
349
    Add(creature);
 
350
 
 
351
    Creature *creature2 = new Creature;
 
352
    creature2->position = Graphics::GetScreenCenter();
 
353
    Add(creature2);
 
354
 
 
355
    Graphics::SetBackgroundColor(Color::green * 0.2f);
 
356
 
382
357
  }
383
358
 
384
359
  void DarkScene::Update()
409
384
            
410
385
            if (isPaused) {
411
386
              player->dark->isVisible = false;
412
 
              ShowSpawners();
413
387
              levelEditor->Enable();
414
388
            } else {
415
 
              HideSpawners();
416
389
              levelEditor->Disable();
417
390
              player->dark->isVisible = true;
418
391
            }