GrowUp::GrowUp(Direction direction)
: MovingSprite(Vector(0,0), "images/powerups/egg/egg.sprite", LAYER_OBJECTS, COLGROUP_MOVING)
{
- physic.enable_gravity(true);
- physic.set_velocity_x((direction == LEFT)?-100:100);
+ physic.gravity_enabled = true;
+ physic.vx = (direction == LEFT?-100:100);
sound_manager->preload("sounds/grow.wav");
}
GrowUp::collision_solid(const CollisionHit& hit)
{
if(hit.top || hit.bottom)
- physic.set_velocity_y(0);
+ physic.vy = 0;
if(hit.left || hit.right)
- physic.set_velocity_x(-physic.get_velocity_x());
+ physic.vx = -physic.vx;
}
HitResponse