I have 0 Heading, 100 Interval and 0 Speed of image sprite. When i change speed (5,10,100,etc.) of image sprite, the image sprite not keep the coordinates and when is dragged is moving alone, to other coordinates.
I cant change the heading. Is another way ?
I cant change the heading. Is another way ?
--
Re: Image sprite speed problem ?
If you change the speed, of course is not going to keep the coordinates, because now that it has speed, it's moving, so the coordinates are being updated constantly.
To change the heading, use the SET ImageSprite.Heading to (any value from 0 to 360).
--
Re: Image sprite speed problem ?
Also post your blocks so we can see what you are trying to do.
--
Re: Image sprite speed problem ?
When i change speed (5,10,100,etc.) of image sprite, the image sprite not keep the coordinates
and when is dragged is moving alone, to other coordinates.
it seems to be, you are using an ImageSprite.Dragged event? how does it look like? any screenshot?
I cant change the heading. Is another way ?
another way to do what?
--
Re: Image sprite speed problem ?
Italo & Taifun
You have right both. Not speed is the problem because is dragged, and speed it should be 0.
My problem is and i thougt is speed, because when i drag image and change coordinates of image 1 with image 2, they flashing, like they cant switch places, but if you drag quicly they switch places. When i drag i want to change places quickly and do not flashing.
I use Italo formula.
You have right both. Not speed is the problem because is dragged, and speed it should be 0.
My problem is and i thougt is speed, because when i drag image and change coordinates of image 1 with image 2, they flashing, like they cant switch places, but if you drag quicly they switch places. When i drag i want to change places quickly and do not flashing.
I use Italo formula.
--
Re: Image sprite speed problem ?
You don't have images for your sprite pictures.
How do you expect to see them?
--
Why flashing when change places ?
The drag event fires multiple times as you drag.
Each time it fires, your sprites switch images, hence the flashing.
You can avoid the flashing by saving the swap for the TouchUp event, and
just moving the dragged sprite to currentX,Y in the Dragged event.
Remembering the original X and Y of the dragged sprite for the later swap is more complicated than I can answer in this post.
--
See attached for how to do a drag and swap for just two sprites.
For more than two sprites, extra blocks would be needed to
calculate which of the sprites on the list is closest to the sprite being dragged,
both for the final swap and for a visual signal that it will be swapped.
--
I try to add more sprites but didnt work. I have 9 sprites.
--
Post an .aia export?
--
--
I will like to thank you very much for your time and help. I try to make it but something is wrong and all pieces come together. I put an aia example.I dont need a reset button. Thank you very much.
--
Your dragging app was complicated by sprite cannibalism, which you can find in this forum's search box.
The dragged_sprite and dragging global variables prevent sprite cannibalism.
The trick to this app is to keep a list of all the sprites, and on a sprite's Touch Up event,
look through the list to find which (if any) sprite it overlaps best for the swap.
Since all your sprites are rectangular and in a grid, and not overlapping, the target sprite
for a swap can be uniquely determined by locating which rectangle holds the center of the dragged sprite.
It might be possible to simplify this app by taking advantage of two new globals added at the start of a drag,
to eliminate the need for TinyDB.
In the meanwhile, here's a working version.
--
Thank you very much. I start my apk with App Inventor (beginner level) in a way and when almost it was finish, i have to make another from 0. :)
Your way is better and now has more stile and it almost new apk. My first vs has multiple screen and when i close it has error, my apk dont want to close. Now vs2 i try to make with 1 screen. This is my first complicated apk. When i finish that, i start a new one. I have a lot of idees and i hope to make it work.
Thank you very much for your time and help. I hope you can help another time. You can close this topic.
--
Your way is better and now has more stile and it almost new apk. My first vs has multiple screen and when i close it has error, my apk dont want to close. Now vs2 i try to make with 1 screen. This is my first complicated apk. When i finish that, i start a new one. I have a lot of idees and i hope to make it work.
Thank you very much for your time and help. I hope you can help another time. You can close this topic.
--
We can save the positions of this sprite ? I mean when we close the screen, the images sprites from canvas to stay saved or if not to make a saved button. Thank you for your help and support.
--
The app I posted saves the sprite positions in TinyDB after every move, but
it starts fresh fro the Designer sprite positions in Screen1.Initialize,
and wipes out the previous (one and only one) save.
To get the sprite positions to persist across runs of the app,
the simplest way would be to add to Screen1.Initialize a new procedure call
to load_all, a procedure to move all sprites to the position saved for
that sprite in TinyDB, only if the tags are already in TinyDB already.
Do this TinyDB tag check before the save_all call.
You can make the load_all procedure quickly by copying the save_all procedure and its children
(if necessary) and editing them.
--
Hello, thank you for your help. I try like you said but i didn't make it. Something i do wrong.
--
Please clip and post images of the four procedures I gave you,
as you implemented.
--
Attached is a working copy.
If it starts with blocks in the wrong place because of residue from experiments in TinyDB, clear TinyDB for a fresh start.
--
Thanks, you have perfectly right. I dont doubt of you for a moment. Thank you very much. My apk is almost finish. Thank you and bless you.
--
My app is multiscreen and i put some buttons and something is not good. My blocks from screen 2 not keep positions. On my app when i swap of Images sprites in screen1 and change screen in screen 2 they have the same position like in screen 1. They swap in the same time when i drag from screen2. Is the positions of the block quilty ?
--
This app does not need multiple screens.
Why did you add them?
--
This is just an example. I making a puzzle that why is easy to make with multiscreen.
--
See this Where's MIT app on the Gallery
and take a guess how many screens it needed.
For more advice on Screens, see the Screens section of this FAQ:
also
--
Oauu, you give a lot to red (joke).
Thank you, thank you, thank you. Once again you help. I am beginer of ai2 and i start an app, i think was to complicate for me. With your help i resolv all my problems and my app is almost finished. I want to make my app with 20 multiscreens, and it has only 3 mb. When i start the app, i dont reach for docs about ai2 and i dont knew it he has a limited screens. Now i finish app with 20 screens, i hope will work. Vs2 i will try to make it with 1 screen. Thank you for your help and God Bless you.
Thank you, thank you, thank you. Once again you help. I am beginer of ai2 and i start an app, i think was to complicate for me. With your help i resolv all my problems and my app is almost finished. I want to make my app with 20 multiscreens, and it has only 3 mb. When i start the app, i dont reach for docs about ai2 and i dont knew it he has a limited screens. Now i finish app with 20 screens, i hope will work. Vs2 i will try to make it with 1 screen. Thank you for your help and God Bless you.
--
Use different screens wisely
Before starting to create another screen, first you should think about is it really necessary? See also Building apps with many screens and SteveJG's post about advantages/disadvantages, because in only one screen you also can use vertical arrangements to simulate different screens, just set the arrangements to visible = true/false as needed... See also Martyn_HK's example about how to use Tabs in App Inventor and another example from Cyd.
The recommended method of switching screens in App Inventor
Before starting to create another screen, first you should think about is it really necessary? See also Building apps with many screens and SteveJG's post about advantages/disadvantages, because in only one screen you also can use vertical arrangements to simulate different screens, just set the arrangements to visible = true/false as needed... See also Martyn_HK's example about how to use Tabs in App Inventor and another example from Cyd.
The recommended method of switching screens in App Inventor
Now i know Taifun. But my app is almost finished. Vs 2 i will try to make it in 1 screen. Thank you for your help.
--
Also remember that more data does not mean more screens, and
a different arrangement of a different set of pictures is just
a few more rows of data in a table or two internally.
Use the data in your puzzle tables to arrange sprites with the right images in the right places
for that puzzle when starting a new puzzle, not the locations you left in the Designer.
--
Ok. Thank you. I have 2 a question for you : Is important to show comment or just add comment and hide in Blocks ? Positions of the blocks in Blocks is important ( we have to put in order, or random )?
Now i change save_all_sprites with first_time_check in Screen Initialize, and when i resolv puzzle1, all puzzle get resolv :)
Now i change save_all_sprites with first_time_check in Screen Initialize, and when i resolv puzzle1, all puzzle get resolv :)
--
. I have 2 a question for you :
Is important to show comment or just add comment and hide in Blocks ?
It's important to add comments to your blocks, to explain what's going on and your design decisions,
for the benefit of other readers and for your own later benefit.
In the early days of a project, when there are only a few blocks, you can get away with using the
right-click-Download -Blocks-As-Image facility with all blocks expanded with their comments.
Unfortunately, there is a bug in the Blocks Editor that relocates comment bubbles far away from their blocks,
making the Blocks area look like a jellyfish. (See attached). For that reason, when I remember to do so,
I close the bubbles after I've taken my screen shots. I also use either the Windows 7 clipping tool or free GreenShot
to save clips of only one event block or procedure at a time, to make it easier to find them by name in a file directory
later when I assemble them with further explanation into a document.
This technique also encourages me to divide my logic up into smaller, simpler, screen sized procedures.
When it comes to coding, macaroni beats spaghetti.
Positions of the blocks in Blocks is important ( we have to put in order, or random )?
There are two considerations here:
1. Will the Blocks Editor crash under the load of too many blocks? Avoid this problem by keeping blocks minimized until you need to see them. Do your searching in the explanatory doc I mentioned earlier. The area of the blocks area seems to be a factor, so I go for a long and skinny area personally.
2. What arrangement of blocks will help you navigate among them? Tastes vary. Some people go alphabetically. I use the same order and indentation as the Table of Contents of my document, which is divided into sections and sub-sections according to function. For event blocks of arrays of buttons, I arrange them by the same shape as the button arrangements.
Now i change save_all_sprites with first_time_check in Screen Initialize, and when i resolv puzzle1, all puzzle get resolv :)
I can't comment on blocks I haven't seen.
Isn't it time to start a new thread for new questions?
Had this been a new thread, I could have re-used it for new people asking the same question.
--
Yes we can close this topic. I published my. I dont start another thread, i think because i want you to answer me. I think you understand what i try to do. I start vs 2 with my app and i get stack. I will try to resolve my problems before searching for help. Thank you for your help.
--
댓글 없음:
댓글 쓰기