# Advanced Hands-on Rust: Mars bounce code wrong (B3 p236)

**URL:** <https://forum.devtalk.com/t/advanced-hands-on-rust-mars-bounce-code-wrong-b3-p236/189232>\
**Category:** PragProg Customers\
**Tags:** book-advanced-hands-on-rust\
**Created:** [28 February 2025 01:28 UTC](https://forum.devtalk.com/t/advanced-hands-on-rust-mars-bounce-code-wrong-b3-p236/189232 "2025-02-28T01:28:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SuperMarioOnlyChild](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@SuperMarioOnlyChild](https://forum.devtalk.com/u/SuperMarioOnlyChild)\
**Post date:** [28 February 2025 01:28 UTC](https://forum.devtalk.com/t/advanced-hands-on-rust-mars-bounce-code-wrong-b3-p236/189232/1 "2025-02-28T01:28:21Z")

</div>

The `bounce` function has the following line:

```auto
bounce = difference;

```

Which should be:

```auto
bounce += difference;

```

Also, I’m not sure why, but the bounding box for the ship in `MarsBaseOneWorldBuilder/mars_base_one/src/main.rs` is commented out, so it passes through walls until uncommented:

```auto
  spawn_image!(
    assets,
    commands,
    "ship",
    0.0,
    200.0,
    1.0,
    &loaded_assets,
    GameElement,
    Player,
    Velocity::default(),
    PhysicsPosition::new(Vec2::new(0.0, 200.0))//,
    //ApplyGravity(0.2),
    //AxisAlignedBoundingBox::new(24.0, 24.0)
  );

```
