/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 03:13:10 UTC
  • Revision ID: josh@9ix.org-20110917031310-jb649nt8e2xy0i6k
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
namespace Dark
4
4
{
5
5
  Player::Player() : Entity(),
6
 
                     FRICTION(400),
7
 
                     MAXSPEED(60.0f),
8
 
                     ACCELERATION(800)
 
6
                     VELOCITY(150.0f)
9
7
  {
10
8
    sprite = new SpriteAnimation("player.png", FILTER_NONE, 64, 64);
11
9
    sprite->Add("idle", 0, 0, 0.35f);
21
19
  {
22
20
    Entity::Update();
23
21
 
24
 
    if (Input::IsKeyMaskHeld("left"))
25
 
      {
26
 
        velocity.x -= ACCELERATION * Monocle::deltaTime;
27
 
      }
28
 
    if (Input::IsKeyMaskHeld("right"))
29
 
      {
30
 
        velocity.x += ACCELERATION * Monocle::deltaTime;
31
 
      }
32
 
    if (Input::IsKeyMaskHeld("up"))
33
 
      {
34
 
        velocity.y -= ACCELERATION * Monocle::deltaTime;
35
 
      }
36
 
    if (Input::IsKeyMaskHeld("down"))
37
 
      {
38
 
        velocity.y += ACCELERATION * Monocle::deltaTime;
39
 
      }
40
 
    
41
 
    // velocity will approach 0 in steps of FRICTION * dt
42
 
    velocity.x = APPROACH(velocity.x, 0, FRICTION * Monocle::deltaTime);
43
 
    velocity.y = APPROACH(velocity.y, 0, FRICTION * Monocle::deltaTime);
44
 
 
45
 
    position += velocity * Monocle::deltaTime;
46
 
 
47
22
    //Scene::GetCamera()->position = position;
48
23
 
49
24
    //...