|
|
@@ -21,9 +21,14 @@ static unsigned int next_id() {
|
|
|
return ++id;
|
|
|
}
|
|
|
|
|
|
+collidable::collidable(graphics::object const & obj)
|
|
|
+ : identity<collidable>(next_id()), render_info_(obj) {}
|
|
|
+
|
|
|
+collidable::collidable(Json::Value const & json, graphics::manager const & mgr)
|
|
|
+ : identity<collidable>(next_id()), render_info_(to_object(json, mgr)) {}
|
|
|
+
|
|
|
entity::entity(Json::Value const & json, graphics::manager const & mgr)
|
|
|
- : identity<entity>(next_id()), velocity(to_vec2(json["velocity"])),
|
|
|
- render_info_(to_object(json, mgr)),
|
|
|
+ : collidable(json, mgr), velocity(to_vec2(json["velocity"])),
|
|
|
frame_texture_coords({make_vector(0.f, 0.f)}),
|
|
|
scale(json["size"].asFloat()), collides_with(0), collides_as(0) {
|
|
|
render_info_.location.size *= scale;
|
|
|
@@ -41,5 +46,3 @@ void entity::update(float delta) {
|
|
|
velocity += acceleration * delta;
|
|
|
// render_info.angle += angular_velocity * delta;
|
|
|
}
|
|
|
-
|
|
|
-void entity::collide(entity const &) {}
|