/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 05:20:04 UTC
  • Revision ID: josh@9ix.org-20110918052004-h8uksv9kzu7vdh0w
beginnings of "stalk" state

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
                         FRICTION(800),
96
96
                         MAXSPEED(80.0f),
97
97
                         ACCELERATION(1200),
98
 
                         STALKSPEED(5.0f),
99
 
                         HUNTSPEED(80.0f)
 
98
                         STALKSPEED(5.0f)
100
99
  {
101
100
    sprite = new SpriteAnimation("creature.png", FILTER_NONE, 64, 64);
102
101
    sprite->Add("idle", 0, 0, 0.35f);
191
190
    else if (state == "stalk")
192
191
      {
193
192
        aiTime += Monocle::deltaTime;
194
 
        noiseTime += Monocle::deltaTime;
195
 
 
196
 
        // Go to HUNT if:
197
 
        // * it's been >1s & we hear the player
198
 
        // * we collide with the player
199
 
        Player *player = ((DarkScene *)scene)->player;
200
 
        if ((aiTime > 1.0f &&  
201
 
             (player->position - position).GetSquaredMagnitude() < 
202
 
             pow(player->noisiness, 2) )
203
 
            || Collide("player")
204
 
            )
205
 
          {
206
 
            state == "hunt";
207
 
            direction = (player->position - position).GetNormalized() * HUNTSPEED;
208
 
            // Play hunt noise (REEET!)
209
 
 
210
 
          }
211
 
          
212
 
          
 
193
 
 
194
        // if we hear the player while stalking (normal range), go to HUNT
 
195
 
213
196
        //after 6 or 7 seconds on the noiseTime clock, play sound and ping again
214
197
        // if we hit a wall, call off the search?
215
198
        //we'll want to play that sound again
216
199
        // do others go ALERT if we start stalking?
217
 
        //probably a timeout here too.
 
200
        // and if we collide with the player?
218
201
      }
219
202
 
220
203
    velocity += direction * ACCELERATION * Monocle::deltaTime;