# Help on diver game

**URL:** <https://forum.makecode.com/t/help-on-diver-game/3640>\
**Category:** Help\
**Created:** [September 26, 2020, 2:02am UTC](https://forum.makecode.com/t/help-on-diver-game/3640 "2020-09-26T02:02:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![UnderwaterAstronaut](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/underwaterastronaut/32/2228_2.png) [@UnderwaterAstronaut](https://forum.makecode.com/u/UnderwaterAstronaut)\
**Post date:** [September 26, 2020, 2:02am UTC](https://forum.makecode.com/t/help-on-diver-game/3640/1 "2020-09-26T02:02:23Z")

</div>

I am trying to make an adventure game where you play as this “diver”. I was planning on making it able to interact with other such as plants to collect them but my code won’t work when I tried it! I also tried to make a statue in which you can save your progress on but when it’s asked, you cant press A to answer yes. Can someone help me figure out what’s wrong and how to fix it?

> **[deep sea diver v2.1](https://arcade.makecode.com/96109-55229-74632-47006)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)\
**Post date:** [September 26, 2020, 5:37am UTC](https://forum.makecode.com/t/help-on-diver-game/3640/2 "2020-09-26T05:37:56Z")

</div>

For the harvesting animation, I think that deleting animations that is not so important could help. I have made a game and due to the amount of animations, some could not work.

---

<div class="post-metadata">

**Author:** ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)\
**Post date:** [September 26, 2020, 7:43am UTC](https://forum.makecode.com/t/help-on-diver-game/3640/3 "2020-09-26T07:43:13Z")

</div>

Great art, I love the main characters animations!

For the plants interaction, these two parts of the code aren’t working together:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/a/ab6b06ac86cdbe8e6b531d0b8e5921511be468cb.png)

When you press the A button while on top of a plant it does trigger the event (you can try putting `destroy sprite otherSprite` in there to see it go away), but the animation isn’t showing up because the on game update is constantly resetting the image. You can add a boolean flag (like moving) that you start at the beginning of the animation and end at the end / after a 500ms pause, and then have the on game update image resetting’s if condition be `if not moving and not collecting`.

Worth a note, Richard has an extension in the works to try and make animations for moving / etc simpler to achieve: [Animate vs Legacy in On Game Update](https://forum.makecode.com/t/animate-vs-legacy-in-on-game-update/3587/2)

Re: Save point; these two portions aren’t working together:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/e/e2e2d52c07ba600d5a35bd5f7290743edd060328.png)

when you create the statue, you clear out the tile, so that tile doesn’t exist anymore and you won’t ever overlap it. Also, you probably don’t want that `ask save game?` in a while loop; it will keep asking again immediately until the player says no, so it looks like nothing is happening. Instead, you can do:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/e/e3aed6cca7f61869770aeee635f354644ed24458.png)

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [September 26, 2020, 3:27pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/4 "2020-09-26T15:27:17Z")

</div>

Wow. Love the art so much.

---

<div class="post-metadata">

**Author:** ![UnderwaterAstronaut](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/underwaterastronaut/32/2228_2.png) [@UnderwaterAstronaut](https://forum.makecode.com/u/UnderwaterAstronaut)\
**Post date:** [September 26, 2020, 3:50pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/5 "2020-09-26T15:50:28Z")

</div>

Thank you! I got the save function to work but how would you add a boolean flag at the beginning and end of the animations?

---

<div class="post-metadata">

**Author:** ![UnderwaterAstronaut](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/underwaterastronaut/32/2228_2.png) [@UnderwaterAstronaut](https://forum.makecode.com/u/UnderwaterAstronaut)\
**Post date:** [September 26, 2020, 3:51pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/6 "2020-09-26T15:51:00Z")

</div>

Thank you! ❤

---

<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:** [September 26, 2020, 4:19pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/7 "2020-09-26T16:19:44Z")

</div>

Yeah the art is very unique

---

<div class="post-metadata">

**Author:** ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)\
**Post date:** [September 26, 2020, 11:46pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/8 "2020-09-26T23:46:04Z")

</div>

The art is good

---

<div class="post-metadata">

**Author:** ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)\
**Post date:** [September 27, 2020, 7:26pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/9 "2020-09-27T19:26:45Z")

</div>

In this case, the event is happening in a sprite overlap event, which makes it a bit easier. Overlap events between two sprites happen outside the game loop, so you can put a pause in that event without breaking the game. So you can do something like this:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/f/f8f65855ae4b709f085b4f200f0af7c8b296f52b.png)

(this also makes it so they can’t move while picking stuff up)

In other events (e.g. sprite overlaps with tiles) this likely won’t work as the code will run immediately / block other things from running. In that case, you would want to use something like richards arcade-story extension to queue up things that will run separately.

---

<div class="post-metadata">

**Author:** ![UnderwaterAstronaut](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/underwaterastronaut/32/2228_2.png) [@UnderwaterAstronaut](https://forum.makecode.com/u/UnderwaterAstronaut)\
**Post date:** [September 28, 2020, 2:55pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/10 "2020-09-28T14:55:20Z")

</div>

thank you!! i’ll be updating if there is any problems!

---

<div class="post-metadata">

**Author:** ![rosalyn.hale](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@rosalyn.hale](https://forum.makecode.com/u/rosalyn.hale)\
**Post date:** [October 1, 2020, 8:29pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/11 "2020-10-01T20:29:30Z")

</div>

I can help.

---

<div class="post-metadata">

**Author:** ![UnderwaterAstronaut](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/underwaterastronaut/32/2228_2.png) [@UnderwaterAstronaut](https://forum.makecode.com/u/UnderwaterAstronaut)\
**Post date:** [October 1, 2020, 10:20pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/12 "2020-10-01T22:20:58Z")

</div>

thank you! I don’t need help now but later if I do then i’ll ask

---

<div class="post-metadata">

**Author:** ![UnderwaterAstronaut](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/underwaterastronaut/32/2228_2.png) [@UnderwaterAstronaut](https://forum.makecode.com/u/UnderwaterAstronaut)\
**Post date:** [November 3, 2020, 2:19am UTC](https://forum.makecode.com/t/help-on-diver-game/3640/13 "2020-11-03T02:19:49Z")

</div>

Because I realized I am going to make this game bigger and have many(?) tilemaps, instead of using if statements to insert the location like before, I thought of using arrays of locations with the tilemap extension.  
The thing is, I don’t know arrays that well and I don’t know how to make the code short while having many many tilemaps. Does anyone know what to do?

---

<div class="post-metadata">

**Author:** ![Darkfeind](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/darkfeind/32/2576_2.png) [@Darkfeind](https://forum.makecode.com/u/Darkfeind)\
**Post date:** [November 17, 2020, 9:51pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/14 "2020-11-17T21:51:55Z")

</div>

Can I maybe help?

---

<div class="post-metadata">

**Author:** ![UnderwaterAstronaut](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/underwaterastronaut/32/2228_2.png) [@UnderwaterAstronaut](https://forum.makecode.com/u/UnderwaterAstronaut)\
**Post date:** [November 17, 2020, 10:57pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/15 "2020-11-17T22:57:59Z")

</div>

Yes please

---

<div class="post-metadata">

**Author:** ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)\
**Post date:** [November 18, 2020, 6:27am UTC](https://forum.makecode.com/t/help-on-diver-game/3640/16 "2020-11-18T06:27:04Z")

</div>

Just male a few and put that it will show random tilemaps.

---

<div class="post-metadata">

**Author:** ![Kat](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kat/32/2596_2.png) [@Kat](https://forum.makecode.com/u/Kat)\
**Post date:** [November 18, 2020, 1:35pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/17 "2020-11-18T13:35:36Z")

</div>

> [@LcAtonal](#):
>
> male

Do you possibly mean make?

---

<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:** [November 18, 2020, 1:45pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/18 "2020-11-18T13:45:22Z")

</div>

The letter “K” and letter “L” are right next to each other. That’s why

---

<div class="post-metadata">

**Author:** ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)\
**Post date:** [November 18, 2020, 1:46pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/19 "2020-11-18T13:46:37Z")

</div>

Make i mean

---

<div class="post-metadata">

**Author:** ![UnderwaterAstronaut](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/underwaterastronaut/32/2228_2.png) [@UnderwaterAstronaut](https://forum.makecode.com/u/UnderwaterAstronaut)\
**Post date:** [November 18, 2020, 4:29pm UTC](https://forum.makecode.com/t/help-on-diver-game/3640/20 "2020-11-18T16:29:46Z")

</div>

Yeah but how would the code be short? cause I don’t want the tilemaps to be random

[Next page](https://forum.makecode.com/t/help-on-diver-game/3640.md?page=2)
