2016년 11월 24일 목요일

Collide vs. Edge Reached


I am teaching an App course using APP Inventor. My students are making a PONG game. One of the students encountered this error. The ball hits the paddle, but the block executed is that the bottom edge reached. I changed canvas height, changed the when paddle.dragged/set y to startY to set y to canvas height - paddle height so it stays on bottom.  I put in a text label to see which block gets executed (when ball.edge reached if edge= -1 then text="edge reached" and also when collided with other then text="collided with". As you can see from picture, ball collided, but text says "edge reached" and game over...

No difference if played on emulator or phone/tablet.

Any suggestions would be greatly appreciated.


Auto Generated Inline Image 1 표시 중
I pl

--
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

Taifun

-- 

Good point. Sorry. I'm still new at this.
Here is most of the blocks:

Auto Generated Inline Image 1 표시 중
-- 
Maybe you need to raise the paddle away from the bottom edge more,
to give the paddle collision precedence over the edge bounce?

Try setting paddle Y lower by Ball1.Radius in the Ball1.Drag event?

ABG


-- 
Thank you. I tried it and it helped most of the time.
I set paddle.move to x= get currentX, y=canvas.height-paddle.height - ball.radius (so it is steady at @303 when canvas has height of 350)
When speed of ball gets too fast (above 50), then the event of edge reached is checked/called before ball collided event.
I have to look into what intervals the ball and paddle should be set to.
Thank you for your assistance.

Auto Generated Inline Image 1 표시 중
-- 

redirected you too many times


I have been using App Inventor 2 on school computers for a year. For the last 4 days every time I try to access http://ai2.appinventor.mit.edu/ I get the followng message:


The ai2.appinventor.mit.edu page isn’t working



ai2.appinventor.mit.edu redirected you too many times.

ERR_TOO_MANY_REDIRECTS

I have tried the following:

clearing cookies twice
changing browsers chrome and firefox (latest versions)
changing the google account it is linked to
tried on other computers in the same school network

So far nothing has worked, any ideas?

-- 
Hi Glen,

Could you try the following and let me know what happens?

1. Open a new private browsing window.
3. At this point you will be redirected to appengine.google.com to provide your login information to Google.
4. After logging in you will be prompted to select the Google account to use with App Inventor (there should only be the one you just logged in)
5. Proceed to App Inventor.

At what number do you end up in the redirect loop?

Also, do you encounter any problems with this account outside of the school? This could indicate that there was a change to your school network's configuration that is incorrectly caching the redirect and resulting in the erroneous loop.

Thanks,
Evan

-- 
Thanks for the reply Evan. I went through your steps and I get the redirect loop after step 3.5. I log in to the google account but I don't get to choose an account in step 4, it just goes straight to the redirect.
I have 2 google accounts that I have tried and they both work outside the school.
The school does block Google docs and Google drive though, this has always been the case. I have been using App inventor for a couple of years without that being an issue though.
I also tried the accounts off the school network last night and they work fine.

My guess is that something has changed on the school network side that is causing this so I just might log a job with them to see if they can resolve it, unless you have any other ideas?

--
Thanks for the response.

The fact that it works just fine outside of the school really suggests to me that it's probably a configuration issue at the school. Although, if they are blocking Docs and Drive, then it may be intentional. When I follow this procedure, steps 3 and 4 are at appengine.google.com, and have nothing to do with App Inventor, so this will likely affect any other service you use that attempts to authenticate via Google.

Evan

-- 
Just to add to the confusion. I was just about to log a job with tech and I had another go and I got in. When I entered though I got a service agreement pop up from app inventor which I have never had before. Once I clicked through the agreement I was able to access App Inventornormally.

OK, everything was looking good again. So I thought I would close down my browser and try again (just to double check). Back to the redirect loop it went. Have tried again several times (no luck). Is there a URL that forces the service agreement to pop up?

-- 
You can access it directly via http://ai2.appinventor.mit.edu/Ya_tos_form.html, but that's not really expected behavior (and the link is subject to change). We did do a release a few minutes ago which is why you may have gotten the display. Are you sure it was the terms of service and not the normal splash/welcome screen we display?

Evan

-- 

Have logged a job with the school and am awaiting their reply. I tried the link you suggested and pressed on the accept button and I get this page <http://ai2.appinventor.mit.edu/ode/accept_tos> But nothing comes up (just all white screen). Thanks for your help.



-- 

Display shrinks when keyboard appears


How do I stop my app from visually shrinking when the keyboard shows up after entering text? This is on a tablet. Is it because I'm using percentages to size things?

--
use Sizing = Responsive instead of Fixed in your Scxeen settings

Taifun


-- 

change color to listpicker elements


i'm wondering how could i change color of a listpicker element

I thought to make another list, in which the elements i press change color
but the question is: how could i change only ONE element color? it's something with selection index, but i can't find a way

--
I know of no way to do that.

There are a lot of Unicode characters, maybe there's one to change colors?
I remember PCDOS had sequences like that for screen text.

No luck on UniCode color changing.

--
actually i'm looking for a method to make a multiselection of list elements in listpicker

-- 
Unicode check boxes that can be copied and pasted into text boxes:




--
than you all
probably i'll try the unicode solution, even the taifun one is great

-- 
Bad news - the check box codes don't show in the listView, at least in the emulator.
See attached.

If you don't need to be fancy, you could substitute:
[_]
[X]

2016-11-23 17_57_38-5554__build_.png 표시 중


-- 
Cool
actually i do not need an empty checkbox, i could add a symbol to the selected item
i'll post my solutions

-- 
and once again, thanx
i'll have a statue in my city

-- 
just a question
how the hell i can insert an unicode code in a textbox? found nothing, and i see the code, not the element

-- 
i had only to copy your check box. whoa, the answer was easy..but in my tablet the symbol are very strange,  seems a mail box with a letter ..
where i can find more symbols like that?

-- 
just want to share this way that works fine for me


 Cattura.png

the only question is, is possible to make the listpicker stable? like listview, that do not close when clicked

-- 


 is possible to make the listpicker stable? like listview, that do not close when clicked



Isn't there a List Picker block to re-open it?

-- 
yes sure, wanted to avoid the movement of the screen, but it does'nt matter

now i'm working in this way.
i created another variable list called OrganizationsDiplayables that i set to ORGANIZATIONS, that when i click on a element i add a " ✓ " , or i delete the  " ✓ " if already present

 Cattura02.png


the question is, how can i create another list "called LINKED ORGANIZATIONS", made by only the elements with " ✓ "?

-- 


the question is, how can i create another list "called LINKED ORGANIZATIONS", made by only the elements with " ✓ "?



Build it up from empty with a loop, each time you flip an element.
Do it in a procedure, so you can also call it at startup.
-- 
i was thinking about that, i only have to understand how to kick out the element from LINKED ORGANIZATIONS when i unflip it

whoa, every thing is an effort

-- 
only have to understand how to kick out the element from LINKED ORGANIZATIONS when i unflip it

Keeping the separate list LINKED ORGANIZATIONS as the primary source of truth during the display of a contact makes it simpler,
and lets you take advantage of two nice list blocks:
IS_IN_LIST and INDEX_IN_LIST, which you can use to feed the
REMOVE ITEM AT INDEX block when an uncheck has occurred.

If you have a list of all possible ORGANIZATIONS in a global, you can loop through that list
and test item by item IS_IN_LIST ( LINKED ORGANIZATIONS) to decide whether or not to check that item when you add
it to your displayable list, for your list picker.

-- 
sorry, but this time i did not understand :-(

-- 
found this way


 Cattura.png
 Cattura04

it seems ok for my purpose, what do you think about?

-- 
Will it accumulate blanks in front of the Organization name if you repeatedly check and uncheck the Organization Selection?
Or are you replacing the check mark with an empty string?
It's hard to see from the blocks shot.

Otherwise, it looks solid.

-- 

Some questions about an SMS text app


1.   I want to create an app that sends (SMS) text messages.

The user will type their message. They will the press the "send" button. The blocks associated with it are "Set texting phone number" and "Set texting phone number". Once the "send" button is pressed the message will be sent.

So far so good I hope.

When you send a message normally through the pre-installed messages app on your phone, any message you send is saved in the outbox until you manually delete it.

Question: will the message sent via the app be saved on the phone in the outbox or anywhere else?



2. When a user receives the message will it be saved to their inbox on their normal pre-installed messages app? If so, then is there any way for it to be saved in the app I have created instead?



3. Is there any way to save a text message from the inbox to a text box in the app?


--

Question: will the message sent via the app be saved on the phone in the outbox or anywhere else?


my guess is, it will be saved in the outbox, but I'm not sure
you might want to test it to find out, if my guess is correctapp
my guess is, it will be saved in the outbox, but I'm not sure
you might want to test it to find out, if my guess is correct


2. When a user receives the message will it be saved to their inbox on their normal pre-installed messages app? If so, then is there any way for it to be saved in the app I have created instead?


it will be saved in the inbox and additionally you can receive it in your App Inventor app in case your app is up and running and save it somewhere else (e.g. TinyDB) 


3. Is there any way to save a text message from the inbox to a text box in the app?


yes, see my Texting Extension, which can read all SMS from the inbox, draft and sent folders.

Taifun

--
What do you mean by:

"you can receive it in your App Inventor app in case your app is up and running and save it somewhere else (e.g. TinyDB) "
Will I use the block "WhenTexting1MessageReceived" do Call TinyDB1 storevalue tag "storemessage" valuetostore "messagetext"

Sorry, I have no idea how to paste blocks so I hope you understand the above.


--
App Inventor apps can't run in the background and while your app is not running, it will not receive an incoming SMS
exception: you are located in the United States and you are using the Google Voice feature. In this case you will get a notification

• If the ReceivingEnabled property is set to 1 messages will not be received. If ReceivingEnabled is set to 2 messages will be received only when the application is running. Finally if ReceivingEnabled is set to 3, messages will be received when the application is running and when the application is not running they will be queued and a notification displayed to the user.                     

• When a message arrives, the MessageReceived event is raised and provides the sending number and message.
• An app that includes this component will receive messages even when it is in the background (i.e. when it's not visible on the screen) and, moreso, even if the app is not running, so long as it's installed on the phone. If the phone receives a text message when the app is not in the foreground, the phone will show a notification in the notification bar. Selecting the notification will bring up the app. As an app developer, you'll probably want to give your users the ability to control ReceivingEnabled so that they can make the phone ignore text messages.                     

Taifun

======================  Screen Capture  +++++++++++++
On Windows  Ctr + PrtScn  keyboard keys pressed at same time copies an image of the screen to the Windows Clipboard.  Open Paint and save the image by placing the contents of the clipboard into Paint. Save the image to your desktop or another folder as a png or jpg file.  On Win 7 and above you can use the Snipping tool (in Accessories) to capture an image of blocks directly from the screen.  Capture what you need and Save the file to a folder on your PC.

On a Mac,  command-shift-3 (whole-screen) or command-shift-4 (drag a rectangle) to take a screenshot. The image file will appear on your desktop. 

Once you have the image of your blocks, you can drag them to MS Word and I think you can drag the image to PowerPoint.

-- 
I don't understand what it means that SMS wil not be received if RECEIVINGENABLED is set to 1.

Surely the message will be saved to the phone's inbox?


--
yes of course, the documentation is taking about App Inventor ... 
probably it's time to try some things?

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here:  http://www.appinventor.org/bookFiles  
How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/howDoYou/eventHandling  .

Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the
 Top 5 Tips: How to learn App Inventor

You will not find a tutorial, which does exactly what you are looking for. But doing the tutorials (not only reading a little bit) help you to understand, how things are working. This is important and this is the first step to do.

Taifun

--