2017년 7월 20일 목요일

Snap To Grid


There have been a few inquiries lately that involved using snap-to-grid as possible solutions.
Here is a discussion of snap-to-grid at the Scratch Wiki: http://wiki.scratch.mit.edu/wiki/Snap_to_Grid
This demo project uses a checkerboard and checker piece to demonstrate the concept of snap-to-grid with App Inventor blocks.
The > YouTube video < describes in detail how snap-to-grid works for this project.
--
Good tutorial. I saw it and commented on YouTube regarding what I am attempting to do. Snap-to-Grid BUT no cannibalism problem will direct you to the pics I created to show what I have so far. 

The question is: How does one have a sprites snap to grid and not be cannibalized (having sprites permanently joined together) on the same canvas (fyi - I used the placeholder)

PICS ARE BELOW


--
See my answer > here <.

--

Need app testers for feedback: Primary School Multiplication Game


I have been working diligently during my summer break from teaching to develop an app to help my elementary school students learn their multiplication facts in a fun way. The app works as a companion to a workbook that I wrote and published on Amazon. I need testers to load the app onto their phone / tablet to see if it works properly. It works in the emulator but one tester noted they could not see some of the objects to 'fling' when they tested it on their phone. I have changed the Screen1 setting to responsive and I am hoping that this issue is resolved. Another known issue is some 'fluttering' between screen changes. I believe I have resolved this issue, but would like feedback from others.

The back button on your phone should result in a page that allows you to see the results of game play (which facts were correct/incorrect) and a link to the workbook on Amazon. (I am not sure if I did the link button properly...but it worked for me.)

(turn down media sound if you don't appreciate music....kids learn math better when learning is accompanied by music--- please note bonus round does have ticking and tada sounds that I would like tested.)

---Also looking for feedback on appearance. I would like it to look professional. Do the directions tutorials make sense?
---Tablet? I have not done any testing with a tablet of any kind. All feedback is appreciated.


--
(oh, aia loaded OK and created apk and barcode OK too)

Tried it out on my Google Nexus 7

Once I had become brave enough to "really swipe" the operators (if too feeble the operator (e.g. X or =) just drifts to the top or the bottom of the page)

I was able to click the correct answer  :). Then this happens:


Tried three times, same thing, so couldn't go any further.

No sound either (but maybe to early in the game?)

-- 
Okay...so you're saying that for Google Nexus 7:


1. swipe of the x and = is too slow
2. main graphics appear to be aligned upper left (not centered)
3. obvious programming error issue as noted by your pic
4. no sound (was your media sound turned up?)

Thank you. Very helpful!

-- 
For good measure i tried it out on my HTC M9 phone.

No app crashes this time, and I got music.

Swiping the operators is still awkward/difficult, they don't seem to go where you swipe to?

Some (hopefully) constructive criticism:

In terms of the app the logic of building the equation doesn't flow correctly:

X 3 X 9 = 27

Would it not be better to move the numbers into an equation x > X  < y = > z  (or does that completely destroy the whole triad thing) ? Or place the operators into the correct positions of the number triad to make the equation? You could create a grid on the canvas to "force" sprites into position

Should I get " a star / smiley face" when I have done the equation correctly, as opposed to picking the correct answer again from a selection ? This doesn't make sense.

However you are the teacher, not me!

-- 
Thank you for the additional information. It is very helpful.

I am not sure I understand your notes.

The flow of the game is supposed to be like the pics in the directions. 

1. first the student flings the 'x' at the multiples.
2. the student flings th "=" at the product
3. the student answers the multiplication question (same numbers as in 'fling' section)
4. If the student selects the correct answer button a "Great Job" picture should display. If an incorrect answer is chosen, a "Nice Try" picture should display.
5. the next set of integers appears for another 'fling' round---and so on.

After 20 correct answers the game play increases in difficulty. The questions are more difficult and there is no more 'fling' this time a book 'shoots' a small multiplication sign and division sign at the triad of numbers. 
There is also a bonus round for every correct 10 answers in level 2. Bonus round is tap the fruit and candy.

I appreciate your input. Everything helps.








-- 
Can you explain or offer an example of the 'grid' to force sprites into position? I checked my .aia on app inventor and I have the game play 'layouts' centered. There is no reason that I can find that they should not be position centered like the number sentences. (I ran the apk for this game on the genymotion emulator for a Google Nexus 7 and I didn't get the 'bad arguments' pop-up....but I did see that the swipe isn't working as it should. It's very slow. Do other AI2 games with 'fling' work properly on your device? (I can't figure out what needs to be changed to make this correction.)

-- 
Sorry to report I get the same "bad arguments to add items to list" reported by Tim during play on both my devices.

I tried this on both a 7" Samsung TabII and an LG Android 4.2.2 phone with similar results.   I ran both using the Companion and after compiling.  Running on the Companion is very slow, the apk is better.  The game centers on the LG but not the tablet.  That is expected on a tablet if one uses Responsive sizing.  There are ways to force the game canvas screen to center.

Made it to 16 before I got the nefarious error message, never to level 2.   I had no issues flinging numbers and   x and =  except on occasion it would misbehave.  A playing note, making it to 20 for the reward of the next level is not going endear users to you.   At 16, I was thoroughly bored, waiting for something else to happen. Running on the bonus round...using Companion I also got 


I believe these are timing issues with your Clocks.

Six screens is not helping .  Going from the start to the play took a while as the app did not want to change screens.. this is expected in live development but not when using the apk.    Your animated instructions are cute but they use up lots of resources.

The results screen is nice! 

I expect the error regarding the list is related to how you also save everything to the TinyDB, seemingly every time something changes...that probably slows the game. This is partially a consequence of having 2 game screens + bonus.   I frequently warn developers of the huge issues created by using and passing TinyDB data among screens. You really only NEED a single game screen.  Some of the score data the apps saves immediatelyalways to the TinyDB could be saved to a global variable and then and only when you change screens, posted to the TinyDB.   

You have 20 timers running...each ends is 000 ms.  Yes, some are on separate screens.  Sooner or later two are going to fire simultaneously and cause an issue.  You have reasons for all of the timer objects, I would get rid of most of them, if you cant part with them,   at least allow the  000 to be a series of random digits, to hopefully avoid collisions .... 123, 005 .... doing so might avoid some collisions if collisions are an issue. Make sure you disable them when they are not needed.

It keeps improving, keep at it.

-- 
Going back to the drawing board. I think I solved the bad arguments error. But I am taking SteveJG's notes into consideration to refine the app more. I will try to get the opening screen blocks on the level1 screen with visible/invisible layouts if possible. While I understand your notes about the timers, I do not understand how the firing would ever coincide as I am enabling and disabling the timers. (There is still so much to learn.) I don't understand why passing to the TinyDB immediately is a problem, but I will try to pass the information to a global variable first then load the information to the TinyDB upon the screen changes. There is only one game screen (I combined them upon my last revision, perhaps you didn't notice.) I have reduced the entire app size to just above 3mb (where as it was close to 5mb before.) I thank you for your continued support.

-- 
And here is a little example based upon your game.  I used a 320x320 canvas and sized everything to 40 pixels.

This could be expanded upon by using if / then blocks to:
⦁ prevent number sprites being dragged onto the operators
⦁ make the number sprites drift back to their original positions if not placed correctly
⦁ do maths with a touch event on the equals sign (show result with notifier?)

-- 
Here are the blocks that resolve my first two points for sprite1.

Had to use a clock to smooth things over


-- 
Regarding the timers:  "I do not understand how the firing would ever coincide as I am enabling and disabling the timers."   If more than one timer is enabled at a time, collisions will occur whenever the timers 'sync'   .  If you turn them off then you avoid the problem, however if you have several timers active simultaneously, there is a huge possibility of 'collisions;.  Remember your duplicating random number issue.  Making the last few digits of a timer unique rather than 000 should ameliorate the possibility.

TinyDB versus a variable:   I have not 'timed' this.  It suspect the time  that  SCORE = newhighscore     takes less time than  SCORE = Tag + newscore  based on performance in some of my own apps.  

An example where things probably can mess up

The roundtimer fires ever 10 seconds

Storing a TinyDB tag with the result of a different tag is not necessarily wrong but the coding circled certainly is suspicious. .

I'll look at your code later again, I missed that all the game stuff is now on one screen (congratulations).  As you make changes, keep previous copies...the app is sufficiently complex that it is easy to do a change .you cannot back out of.  

Tim has some interesting ideas that might work to improve game play, unfortunately snapping to grid adds another Timer....oh well..what you might have to do with asynchronous programming to get it to work better. Unfortunately AI2 is not a game engine, the graphic refresh stinks compared to java solutions so one needs to be flexible

-- 

Using phonecall with saved contacts


I have made Phonecaller and Texting successfully using option to enter phone number while creating app on PC.

I wanted to do that while app is running on Android device.
Is there any way to do that - to add phone number(s) in app memory and use them for Phonecaller?

I suppose that it can be done combining TinyDB and PhoneNumberPicker, but at this moment I can't figure that out.

So can someone please give me some tips how to do that.

--

I think it would be a good idea to post the blocks you have so far, otherwise we need to shoot in the blind.

-- 
thank you for your answer.
Here are blocks for Texting and PhoneCall.



This works great with phone number entered here:

But I wanted to do as I described in first message - to be able to add number/s in app(while it is running on Android device).

--
What's the BlueTooth device, and how does it fit into your scheme?

-- 
What about putting a TexBox in your design, tick the NumbersOnly checkbox. Fill the TextBox in when running your app with the desired phonenumber and set the phonenumber just before you make the call to the PhoneCall component.
??

-- 
bluetooth device is Arduino with HC-05 module.
It works flawless.

that's great idea, but if I'm understand well, in that way, number will have to be entered every time when app is started (after you close the app completely)?
I mean, it won't be saved in app, right?
Do I need for that TinyDB?

--
I tried now to play with TinyDB, but I obviously lost somewhere a little bit.
Here are new blocks.








When I enter number in Text Box and click Save number, I get message ''Number added''.
But, when I try to call it from memory, by clicking on Open list, I'm getting message 'true' on Text Box.

So, I need some tips where I made big mistake...

-- 
Yes, you are trying to send true, because that is the value of TextBox.Numbersonly.
The Numbers only attribute is something you should set in the design screen, to prevent your user from typing abc as phone number.
As tag for the TinyDB you should use something like 'phonenumber'. And as value TextBox.Text. Try that. I did not see the actual phone call in your blocks anymore, where is it?
You can debug your work, when conncet d to the AI Companion by clicking with your right mouse button on a block and choose DoIt. You can see what the value of something is, or execute a procedure etc.

--
Most AI2 blocks have tool tips, little pop up bubbles explaining them,
that appear if you hover your cursor on them in the Blocks Editor.

-- 
See the TinyDB section of this FAQ for some easy samples ...

-- 
Thank you very much both for your help.
I managed to make it work with next blocks:


So at this moment, everything works as I  wanted.
I will write here in case I need more help.

--

Hi,
I have new question, it is same app but with different problem.
My app contains Texting, and problem is that when I receive SMS, phone shows it via built in SMS app and also via Mit App.
How can I disable that Mit App show SMS notification on screen every time I receive SMS?

--