# Changing Scenes Once Off Screen?

**URL:** https://discourse.processing.org/t/changing-scenes-once-off-screen/4934
**Category:** Coding Questions
**Created:** [October 27, 2018, 5:25pm UTC](https://discourse.processing.org/t/changing-scenes-once-off-screen/4934 "2018-10-27T17:25:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Maxim](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@Maxim](https://discourse.processing.org/u/Maxim)
#### Post date: [October 27, 2018, 5:25pm UTC](https://discourse.processing.org/t/changing-scenes-once-off-screen/4934/1 "2018-10-27T17:25:28Z")

</div>

so essentially, I want to make it so when a ship i have controlled with WASD goes greater than width, then the scene changes to another one, however the ship gets reset to the center of that new scene. Is that Possibe

---

<div class="post-metadata">

### Author: ![Architector\_4](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/architector_4/32/813_2.png) [@Architector\_4](https://discourse.processing.org/u/Architector_4)
#### Post date: [October 27, 2018, 5:38pm UTC](https://discourse.processing.org/t/changing-scenes-once-off-screen/4934/2 "2018-10-27T17:38:38Z")

</div>

It’s hard to answer such a question without any code. That is indeed possible, but I don’t really know which way you made your code work.

Although, I suggest you to make new variables for the ship position; before you switch the scene, you store the coordinates of the ship in them, and after you switch the scene, you load your coordinates from there.

---

<div class="post-metadata">

### Author: ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)
#### Post date: [October 27, 2018, 6:30pm UTC](https://discourse.processing.org/t/changing-scenes-once-off-screen/4934/3 "2018-10-27T18:30:29Z")

</div>

What you want done converts almost directly into code.

```auto
if ( ship.position.x > width ){ // If the ship's position is outside the screen on the right,
  scene_number++; // Go to the next scene.
  ship.position.x = width/2; // And recenter the ship.
  ship.position.y = height/2;
}

```
