# Two questions about sprites

**URL:** <https://community.thunkable.com/t/two-questions-about-sprites/224996>\
**Category:** Questions about Thunkable X\
**Tags:** tcanvas\
**Created:** [September 13, 2019, 12:41pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996 "2019-09-13T12:41:31Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![approeduc](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@approeduc](https://community.thunkable.com/u/approeduc)\
**Post date:** [September 13, 2019, 12:41pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/1 "2019-09-13T12:41:31Z")

</div>

- When I create one sprite in Design mode, I see two sprites in the working app.  
What is my mistake?

 ![45](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/8/e89bfe463d5e3d1c5ed759e11b36a923ae0575e8.png)

- When I try to reflect a sprite at the edges without activating bounce (!) but by calculating the new angle of movement, it does not work  
 ![11](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/b/cb8a58c45297fd3cb90cbe102aa24178718f62a2.png)

---

<div class="post-metadata">

**Author:** ![BlueWhaleYT](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/bluewhaleyt/32/28437_2.png) [@BlueWhaleYT](https://community.thunkable.com/u/BlueWhaleYT)\
**Post date:** [September 13, 2019, 1:44pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/2 "2019-09-13T13:44:09Z")

</div>

Hi there, @approeduc.  
I couldn’t solve your second question about the block structure of canvas.  
The “two sprites”,I can tell you that is originally and this is no mistake you did.This is default setup by the developer.

---

<div class="post-metadata">

**Author:** ![approeduc](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@approeduc](https://community.thunkable.com/u/approeduc)\
**Post date:** [September 13, 2019, 3:42pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/3 "2019-09-13T15:42:12Z")

</div>

OK,  
but what do I do, if I only want one sprite?

---

<div class="post-metadata">

**Author:** ![BlueWhaleYT](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/bluewhaleyt/32/28437_2.png) [@BlueWhaleYT](https://community.thunkable.com/u/BlueWhaleYT)\
**Post date:** [September 13, 2019, 3:44pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/4 "2019-09-13T15:44:09Z")

</div>

I think it is impossible to do it with one sprite.

---

<div class="post-metadata">

**Author:** ![rollke](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/rollke/32/14413_2.png) [@rollke](https://community.thunkable.com/u/rollke)\
**Post date:** [September 13, 2019, 4:08pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/5 "2019-09-13T16:08:59Z")

</div>

The block “create sprite” is one too much. Without this there is only the one sprite designed in design mode.

---

<div class="post-metadata">

**Author:** ![rollke](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/rollke/32/14413_2.png) [@rollke](https://community.thunkable.com/u/rollke)\
**Post date:** [September 13, 2019, 4:12pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/6 "2019-09-13T16:12:52Z")

</div>

But changing the direction is confusing.

What is the difference between the block categories “motion” and “direction”.  
For me I would think that changing the angle in the motion blocks would solve the problem. But they do not.??

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [September 13, 2019, 7:03pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/7 "2019-09-13T19:03:07Z")

</div>

You just use the wrong block to determine the angle. Use this to get the angle.

![%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/e/5ee2097a010c65c581af2fb59a6471df23fc63f5.png)

---

<div class="post-metadata">

**Author:** ![rollke](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/rollke/32/14413_2.png) [@rollke](https://community.thunkable.com/u/rollke)\
**Post date:** [September 13, 2019, 8:19pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/8 "2019-09-13T20:19:44Z")

</div>

Thank you actech,  
but there are still problems:  
You cannot determine the angle with this block between the ball sprite and the edge of the canvas.  
And if you change the angle of the sprite (e.g. as a test with a number) then the motion of the sprite-movement does not change - the orientation of the sprite changes. This does not solve my problem to change the direction of the movement after colliding with the edge of the canvas.

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [September 13, 2019, 9:11pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/9 "2019-09-13T21:11:01Z")

</div>

It is necessary to use sprites instead of the edges of the canvas. To do this, create 4 sprites in the form of rectangles that will replace the edges of the canvas. Is such a solution suitable for you?

![%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/b/db843559f0ee00bf860c699f35eb3a5cc499a552.png)

---

<div class="post-metadata">

**Author:** ![paulmw](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@paulmw](https://community.thunkable.com/u/paulmw)\
**Post date:** [September 13, 2019, 9:41pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/10 "2019-09-13T21:41:31Z")

</div>

1. When you create a sprite in design mode, you should only see one sprite in the working app. In the tree, it shows you the type of sprite, in case you want to make more than one sprite of that type (ie you want multiple enemies in your game that all behave the same way). If you see two separate sprites in the app, but only added one, send me a link and I’ll take a look.

2. Setting the angle (both in the direction drawer and the motion drawer) sets the direction that the sprite is **pointing** (not moving).

With the blocks that exist now, you can point a sprite in a direction and move it in that direction to simulate a bouncing effect: [https://x.thunkable.com/copy/17af106c6ab74e175603e17903ff43f9](https://x.thunkable.com/copy/17af106c6ab74e175603e17903ff43f9)

For now, I’d recommend using the bounce property: [https://x.thunkable.com/copy/8bdccb28365fd3ca654531788949c224](https://x.thunkable.com/copy/8bdccb28365fd3ca654531788949c224)

Eventually we’ll give you blocks that allow you to know the angle you are moving at, and the ability to set the speed at a particular angle, but we haven’t released those yet.

* * *

If you want multiple sprites that behave the same way, you can make them part of the same sprite type and they will share properties and code. In the example below, all of the sprites are in SpriteType1 and they all have a bounce of 100. Also when any of them hit any edge their angle changes by 10.

[https://x.thunkable.com/copy/6e7c3e612f7ee7e162c52c88236f940a](https://x.thunkable.com/copy/6e7c3e612f7ee7e162c52c88236f940a)

---

<div class="post-metadata">

**Author:** ![rollke](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/rollke/32/14413_2.png) [@rollke](https://community.thunkable.com/u/rollke)\
**Post date:** [September 13, 2019, 9:59pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/11 "2019-09-13T21:59:41Z")

</div>

Thank you!  
This answer explains the problems, I ran into.

So simplifying I understand:  
We cannot determine the direction a sprite is moving and we cannot change the direction of the movement via programming an angle.

---

<div class="post-metadata">

**Author:** ![paulmw](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@paulmw](https://community.thunkable.com/u/paulmw)\
**Post date:** [September 14, 2019, 2:25am UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/12 "2019-09-14T02:25:05Z")

</div>

> We cannot determine the direction a sprite is moving and we cannot change the direction of the movement via programming an angle.

For now, yes. There is probably fancy trigonometry you could do to calculate the arctan2 from the x and y speed to find the moving angle, and to set the speed, but I’d just wait until we get the blocks released

---

<div class="post-metadata">

**Author:** ![rollke](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/rollke/32/14413_2.png) [@rollke](https://community.thunkable.com/u/rollke)\
**Post date:** [September 14, 2019, 9:15am UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/13 "2019-09-14T09:15:54Z")

</div>

Ok, this is what changing the angle does:

[https://x.thunkable.com/copy/28a653620ac7b77425ddb61515a185b5](https://x.thunkable.com/copy/28a653620ac7b77425ddb61515a185b5)

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [September 14, 2019, 9:20am UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/14 "2019-09-14T09:20:33Z")

</div>

An example of obtaining the angle of movement of a sprite.

[https://x.thunkable.com/projects/5d78020ff0a03f3f9502e551/project/properties/designer/](https://x.thunkable.com/projects/5d78020ff0a03f3f9502e551/project/properties/designer/)

---

<div class="post-metadata">

**Author:** ![rollke](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/rollke/32/14413_2.png) [@rollke](https://community.thunkable.com/u/rollke)\
**Post date:** [September 14, 2019, 9:24am UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/15 "2019-09-14T09:24:14Z")

</div>

Clever 😉

---

<div class="post-metadata">

**Author:** ![tuffla9910](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tuffla9910/32/93071_2.png) [@tuffla9910](https://community.thunkable.com/u/tuffla9910)\
**Post date:** [January 8, 2021, 9:53pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/16 "2021-01-08T21:53:34Z")

</div>

Just delete the object called ‘ball’ below the ‘Sprite\_Type1’. This is an individual sprite, drawn on the stage, but it is in the sprite group ‘Sprite\_Type1’. You can place new sprites of type ‘Sprite\_Type1’ onto the stage by dragging them from the bottom drawer on the left. This is useful to test out the placing of a sprite in the group, or the size of the sprites in the sprite group.

Your create blocks create an individual sprite programmatically. That is the way to go to keep track of the sprites in Your app. The sprite You create can then be reached via the green component block. The block where You show ‘ball’ can be omitted.

In the collide block, You should change ‘ball’ to ‘sprite’, by dragging the green block into the places where ‘ball’ is in the set angle block.

---

<div class="post-metadata">

**Author:** ![tuffla9910](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tuffla9910/32/93071_2.png) [@tuffla9910](https://community.thunkable.com/u/tuffla9910)\
**Post date:** [January 8, 2021, 9:56pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/17 "2021-01-08T21:56:46Z")

</div>

Particle movement in thunkable, for those interested. The particles however, slow down over time, and stop. I think this happens because of rounding errors as the collitions commence.

> **[Thunkable](https://x.thunkable.com/copy/8dbe573b640f86f6771a00d55560d1fe)**

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 12:09pm UTC](https://community.thunkable.com/t/two-questions-about-sprites/224996/18 "2024-11-08T12:09:04Z")

</div>


