# How to return camera to a common place

**URL:** <https://forum.makecode.com/t/how-to-return-camera-to-a-common-place/15921>\
**Category:** Help\
**Created:** [October 20, 2022, 4:30pm UTC](https://forum.makecode.com/t/how-to-return-camera-to-a-common-place/15921 "2022-10-20T16:30:29Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![watermarkedu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/watermarkedu/32/6925_2.png) [@watermarkedu](https://forum.makecode.com/u/watermarkedu)\
**Post date:** [October 20, 2022, 4:30pm UTC](https://forum.makecode.com/t/how-to-return-camera-to-a-common-place/15921/1 "2022-10-20T16:30:29Z")

</div>

Good morning,

```
     I have student who made the following game: [https://arcade.makecode.com/77060-13028-42082-82982](https://arcade.makecode.com/77060-13028-42082-82982).

     The object is to create a game that pitches a baseball (from the sprite, "baseball_player_2") and then when it touchs the hitter sprite ("baseball_Player_1"), the player could take a swing and make a hit. Right now, the hitter just has a simple collision that randomly sends the ball into an outfield.  

   The student also used a camera control to show the ball moving up the field. The student wanted the game to reset to allow another pitch and bring the camera back to the pitcher. I assume a function would work easily here, that would return to the starting point after a specific amount of time.

     TL;DR: **I was wondering if anyone has coded a similar project: an input to trigger a sprite to "pitch" a ball, then "hit" the ball with a trigger when it comes in contact with the another sprite.** I thought that a Pong example would work, but it seems difficult to code it to check for a collision and if the user is pressing a button to create the "hitting" action. Any suggestions are welcome, we have been really frustrated trying to think of solutions.

      Best wishes,
                   Mark

```

---

<div class="post-metadata">

**Author:** ![personalnote](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/personalnote/32/31359_2.png) [@personalnote](https://forum.makecode.com/u/personalnote)\
**Post date:** [October 21, 2022, 4:08pm UTC](https://forum.makecode.com/t/how-to-return-camera-to-a-common-place/15921/2 "2022-10-21T16:08:28Z")

</div>

I think you should first create a sprite that represents the camera’s start position. Then when the ball is hit, you make the camera follow the ball and once you want the camera to go back, make the camera follow the sprite (Start position).

If it seems a bit confusing I can head into the editor and show you how to do it.

---

<div class="post-metadata">

**Author:** ![Blobbey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/blobbey/32/20831_2.png) [@Blobbey](https://forum.makecode.com/u/Blobbey)\
**Post date:** [October 21, 2022, 5:04pm UTC](https://forum.makecode.com/t/how-to-return-camera-to-a-common-place/15921/3 "2022-10-21T17:04:47Z")

</div>

Is this what you were looking for?  
[Baseball](https://arcade.makecode.com/S58864-94825-52543-33179)  
I just added and changed a few things.  
 ![Screenshot 2022-10-20 134927](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/1/1ed74db92ea06ca5efbddf2b73c166889eddfdd6.jpeg)  
I hope this helps! 🙂

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [October 21, 2022, 5:17pm UTC](https://forum.makecode.com/t/how-to-return-camera-to-a-common-place/15921/4 "2022-10-21T17:17:33Z")

</div>

Nice baseball game! I’ll leave you a list of what I fixed for your student.

> **[Baseball](https://arcade.makecode.com/36940-11430-53676-87376)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I set up the camera so it will be there now after the ball hits a wall.  
The ball will be flung if you hit “X” on the keyboard if it is overlapped with the pitcher

> **[Baseball (dreadmask)](https://arcade.makecode.com/36761-86075-43323-48268)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

This is a version I decided to do if he wants to see the code

---

<div class="post-metadata">

**Author:** ![watermarkedu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/watermarkedu/32/6925_2.png) [@watermarkedu](https://forum.makecode.com/u/watermarkedu)\
**Post date:** [October 24, 2022, 4:41pm UTC](https://forum.makecode.com/t/how-to-return-camera-to-a-common-place/15921/5 "2022-10-24T16:41:11Z")

</div>

This truly well designed, especially clever having a catcher (aka “GuyBehindBatter”)! The way you added the position of the players using the “set position” was a good call as well as deducting health for strikes. Thank you for explaining and offering your solutions.

Random thought: I am hope that someday an extension would exist to let us change the “hearts” for health into something else. It would be fun to have those as baseballs or something else to label to the strikes.

---

<div class="post-metadata">

**Author:** ![MakeCode](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@MakeCode](https://forum.makecode.com/u/MakeCode)\
**Post date:** [October 24, 2022, 4:51pm UTC](https://forum.makecode.com/t/how-to-return-camera-to-a-common-place/15921/6 "2022-10-24T16:51:16Z")

</div>

We don’t have it in an extension yet? Crazy!

You can do it now if you don’t mind writing a little Javascript:

info.setLifeImage(img`.`)

It’s also not too hard to do it with the textSprite extension and the icon, as long as you keep track of lives in a separate variable.

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [October 24, 2022, 4:54pm UTC](https://forum.makecode.com/t/how-to-return-camera-to-a-common-place/15921/7 "2022-10-24T16:54:18Z")

</div>

I believe I know what you’re saying. Are you talking about changing the sprites into some kind of baseball sprite?

---

<div class="post-metadata">

**Author:** ![watermarkedu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/watermarkedu/32/6925_2.png) [@watermarkedu](https://forum.makecode.com/u/watermarkedu)\
**Post date:** [October 24, 2022, 4:54pm UTC](https://forum.makecode.com/t/how-to-return-camera-to-a-common-place/15921/8 "2022-10-24T16:54:25Z")

</div>

Wow, this was an amazing version and yes, exactly what the student was looking for. This worked tremendously well and makes so much sense as a conditional statement. The reseting of the ball once it goes off the screen was a wonderful addition too! Thank you for taking the time to work through this for us and share your solution. It was incredibly helpful!

---

<div class="post-metadata">

**Author:** ![watermarkedu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/watermarkedu/32/6925_2.png) [@watermarkedu](https://forum.makecode.com/u/watermarkedu)\
**Post date:** [October 24, 2022, 4:54pm UTC](https://forum.makecode.com/t/how-to-return-camera-to-a-common-place/15921/9 "2022-10-24T16:54:35Z")

</div>

Your idea made a lot of sense. I was in the process of exploring that when I received the second reply. I wanted to thank you though for consideration and response. It was a helpful to have your suggestion to talk it out with my student.

---

<div class="post-metadata">

**Author:** ![watermarkedu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/watermarkedu/32/6925_2.png) [@watermarkedu](https://forum.makecode.com/u/watermarkedu)\
**Post date:** [October 24, 2022, 11:19pm UTC](https://forum.makecode.com/t/how-to-return-camera-to-a-common-place/15921/10 "2022-10-24T23:19:06Z")

</div>

That’s a really good project for some of my advanced students or high school ones. Thanks for the suggestion! 😃

---

<div class="post-metadata">

**Author:** ![personalnote](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/personalnote/32/31359_2.png) [@personalnote](https://forum.makecode.com/u/personalnote)\
**Post date:** [October 24, 2022, 11:20pm UTC](https://forum.makecode.com/t/how-to-return-camera-to-a-common-place/15921/11 "2022-10-24T23:20:05Z")

</div>

no problem!
