Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
skhaz committed Dec 16, 2024
1 parent 5c41b8d commit 3422957
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ void entity::set_velocity(const math::vector2d &velocity) noexcept {
}

math::vector2d entity::velocity() const noexcept {
// cpVect velocity = cpBodyGetVelocity(_props.body.get());
// return {velocity.x, velocity.y};
return _props.velocity;
}

Expand Down Expand Up @@ -87,14 +85,9 @@ void entity::update(float_t delta) noexcept {
}
}

// const auto body = _props.body.get();
// _props.angle = cpBodyGetAngle(body);

// const auto position = cpBodyGetPosition(body);
// _props.position.set(
// static_cast<int32_t>(std::round(position.x)),
// static_cast<int32_t>(std::round(position.y))
// );
const auto x = static_cast<int32_t>(_props.position.x() + _props.velocity.x() * delta);
const auto y = static_cast<int32_t>(_props.position.y() + _props.velocity.y() * delta);
_props.position.set(x, y);
}

void entity::draw() const noexcept {
Expand Down

0 comments on commit 3422957

Please sign in to comment.