/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-17 17:12:23 UTC
  • Revision ID: josh@9ix.org-20110917171223-hsvrl6q7mxxbc1sv
creatures move less, make everything smaller

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
{
5
5
  Player::Player() : Entity(),
6
6
                     FRICTION(400),
7
 
                     MAXSPEED(60.0f),
 
7
                     MAXSPEED(20.0f),
8
8
                     ACCELERATION(800)
9
9
  {
10
10
    sprite = new SpriteAnimation("player.png", FILTER_NONE, 64, 64);
11
11
    sprite->Add("idle", 0, 0, 0.35f);
12
12
    sprite->Play("idle");
13
13
    SetGraphic(sprite);
 
14
    scale = Vector2(0.25, 0.25);
14
15
 
15
16
    AddTag("player");
16
17
 
17
18
    footsteps = Audio::NewDeck(Assets::RequestAudio("footsteps.ogg"));
18
19
    footsteps->SetLoops(0); //loop indefinitely
19
20
    
20
 
    SetCollider(new RectangleCollider(32, 32));
 
21
    SetCollider(new RectangleCollider(16, 16));
21
22
  }
22
23
 
23
24
  void Player::Update()
78
79
 
79
80
  Creature::Creature() : Entity(),
80
81
                         FRICTION(800),
81
 
                         MAXSPEED(30.0f),
 
82
                         MAXSPEED(15.0f),
82
83
                         ACCELERATION(1200)                      
83
84
  {
84
85
    sprite = new SpriteAnimation("creature.png", FILTER_NONE, 64, 64);
86
87
    sprite->Add("move", 1, 2, 4.0f);
87
88
    sprite->Play("idle");
88
89
    SetGraphic(sprite);
 
90
    scale = Vector2(0.25, 0.25);
89
91
 
90
92
    AddTag("creature");
91
 
    SetCollider(new RectangleCollider(32, 32));
 
93
    SetCollider(new RectangleCollider(16, 16));
92
94
 
93
95
    skitter1 = Audio::NewDeck(Assets::RequestAudio("skitter1.ogg"));
94
96
    skitter1->SetLoops(0); //loop indefinitely
95
97
 
96
 
    velocity = Vector2::Random() * ACCELERATION;
 
98
    velocity = Vector2::Random() * MAXSPEED;
97
99
 
98
100
    //set aiTime to random so creatures tick at different times
99
101
    aiTime= (float(rand()) / float(RAND_MAX)) * 1.0f;
106
108
    aiTime += Monocle::deltaTime;
107
109
    if (aiTime > 1.0f)
108
110
      {
109
 
        switch (rand() % 2)
 
111
        switch (rand() % 3)
110
112
          {
111
113
          case 0: // idle
112
114
            //printf("idle\n");