void
GrowUp::collision_solid(const CollisionHit& hit)
{
- if(hit.top || hit.bottom)
+ if(hit.top)
+ physic.set_velocity_y(0);
+ if(hit.bottom && physic.get_velocity_y() > 0)
physic.set_velocity_y(0);
if(hit.left || hit.right)
physic.set_velocity_x(-physic.get_velocity_x());
return FORCE_MOVE;
}
+
+void
+GrowUp::do_jump()
+{
+ physic.set_velocity_y(-300);
+}
virtual void update(float elapsed_time);
virtual void collision_solid(const CollisionHit& hit);
virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
+ void do_jump();
};
#endif