equal
deleted
inserted
replaced
8 player(player), |
8 player(player), |
9 visible(visible), |
9 visible(visible), |
10 weapon(weapon) |
10 weapon(weapon) |
11 { |
11 { |
12 // set birth tick |
12 // set birth tick |
13 birth_tick = world.tick_timer.get_ticks(); |
13 birth_tick = world.getTicks(); |
14 |
14 |
15 // XXX: projectiles should be particles? |
15 // XXX: projectiles should be particles? |
16 std::vector<Vector> shape(4); |
16 std::vector<Vector> shape(4); |
17 |
17 |
18 shape[0] = Vector(0 , -weapon->getRadius() ); |
18 shape[0] = Vector(0 , -weapon->getRadius() ); |
30 player->state.projectiles.remove(this); |
30 player->state.projectiles.remove(this); |
31 } |
31 } |
32 |
32 |
33 void Projectile::onDestroy (Vector position, bool removeGround) { |
33 void Projectile::onDestroy (Vector position, bool removeGround) { |
34 if (removeGround) |
34 if (removeGround) |
35 world.removeGround(position, weapon->getExplosionRadius()); |
35 world.terrain.removeGround(position, weapon->getExplosionRadius()); |
36 |
36 |
37 destroy(); |
37 destroy(); |
38 } |
38 } |
39 |
39 |
40 Health Projectile::getDamage () { |
40 Health Projectile::getDamage () { |
66 onDestroy(collisionPoint, true); |
66 onDestroy(collisionPoint, true); |
67 } |
67 } |
68 |
68 |
69 void Projectile::tick (TimeMS dt) { |
69 void Projectile::tick (TimeMS dt) { |
70 // expire projectiles |
70 // expire projectiles |
71 if (world.tick_timer.get_ticks() > birth_tick + weapon->getExpire()) |
71 if (world.getTicks() > birth_tick + weapon->getExpire()) |
72 onDestroy(position, true); |
72 onDestroy(position, true); |
73 |
73 |
74 // super |
74 // super |
75 PhysicsObject::tick(dt); |
75 PhysicsObject::tick(dt); |
76 } |
76 } |