/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 03:38:46 UTC
  • Revision ID: josh@9ix.org-20110918033846-f2unltomwd0ula81
alert noise

Show diffs side-by-side

added added

removed removed

Lines of Context:
155
155
            state = "alert";
156
156
            alert->Play();
157
157
            direction = Vector2::zero;
158
 
            Ping::NewPing(position, 8.0f, 32.0f, 0.15f); // ping diameter 16-64 over .5s
 
158
            // TODO: Play pulse animation (yellow?)
159
159
            aiTime = 0.0f; // diff variable?  stateTime?
160
160
          }
161
161
      } // if idle or wander
220
220
      }
221
221
  }
222
222
 
223
 
  Ping::Ping() : Entity(),
224
 
                 d1(0.0f), d2(0.0f), t(0.0f), t2(0.0f)
225
 
  {
226
 
    sprite = new Sprite("yellow.png", FILTER_LINEAR, 64, 64);
227
 
    SetGraphic(sprite);
228
 
    scale = Vector2::zero;
229
 
  }
230
 
 
231
 
  Ping *Ping::NewPing(Vector2 pos, float d1, float d2, float t2)
232
 
  {
233
 
    Ping *ping = new Ping();
234
 
    ping->d1 = d1;
235
 
    ping->d2 = d2;
236
 
    ping->t2 = t2;
237
 
    ping->position = pos;
238
 
 
239
 
    Game::GetScene()->Add(ping);
240
 
    return ping;
241
 
  }
242
 
 
243
 
  void Ping::Update()
244
 
  {
245
 
    Entity::Update();
246
 
 
247
 
    // once we're done LERPing, get gone
248
 
    if (t > t2)
249
 
      RemoveSelf();
250
 
 
251
 
    t += Monocle::deltaTime;
252
 
    float scaleFactor = LERP(d1/64, d2/64, t/t2);
253
 
    scale = Vector2(scaleFactor, scaleFactor);
254
 
  }
255
 
 
256
223
  // Scene
257
224
 
258
225
  DarkScene::DarkScene() : Scene()