/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-19 16:45:22 UTC
  • Revision ID: josh@9ix.org-20110919164522-dtd7of8u0ylmvs0s
harder maze, safe zone, they kill you

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
    bool xcol = false;
59
59
    bool ycol = false;
60
60
 
61
 
    Collider *collider = NULL;
62
 
 
63
61
    position.x += velocity.x * Monocle::deltaTime;
64
 
    while (Collide("Solid") || (collider = Collide("creature")))
 
62
    while (Collide("Solid"))
65
63
      {
66
 
        // Don't colide with hunters.  We should just die.
67
 
        if (collider) {
68
 
          Creature *c = (Creature *) collider->GetEntity();
69
 
          if (c->state == "hunt") { break; }
70
 
        }
71
 
 
72
64
        xcol = true;
73
65
        if (velocity.x == 0) { break; }
74
66
        //printf("collision1\n");
76
68
      }
77
69
    if (xcol) {velocity.x = 0;}
78
70
 
79
 
    collider = NULL;
80
71
    position.y += velocity.y * Monocle::deltaTime;
81
 
    while (Collide("Solid") || (collider = Collide("creature")))
 
72
    while (Collide("Solid"))
82
73
      {
83
 
        // Don't colide with hunters.  We should just die.
84
 
        if (collider) {
85
 
          Creature *c = (Creature *) collider->GetEntity();
86
 
          if (c->state == "hunt") { break; }
87
 
        }
88
 
 
89
74
        ycol = true;
90
75
        if (velocity.y == 0) { break; }
91
76
        //printf("collision2\n");
121
106
    scale = Vector2(0.25, 0.25);
122
107
 
123
108
    AddTag("creature");
 
109
    AddTag("Solid");
124
110
    SetCollider(new RectangleCollider(16, 16));
125
111
 
126
112
    alert = Assets::RequestAudio("alert.ogg");
127
113
    freakout = Assets::RequestAudio("freakout.ogg");
128
 
    chomp = Assets::RequestAudio("chomp.ogg");
129
114
    skitter1 = Audio::NewDeck(Assets::RequestAudio("skitter1.ogg"));
130
115
    skitter1->SetLoops(0); //loop indefinitely
131
116
    sniff = Audio::NewDeck(Assets::RequestAudio("sniff.ogg"));
277
262
 
278
263
        // if we collide with you, move you back to the starting point
279
264
        if (Collide("player")) {
280
 
          // TODO: first wait a second or 3?
281
 
          chomp->Play();
 
265
          // TODO: first, make chompy noises and wait a second or 3?
282
266
          DarkScene *scene = (DarkScene *) GetScene();
283
267
          Entity* playersp = scene->GetFirstEntityWithTag("playerspawner");
284
268
          scene->player->position = playersp->position;