Skip to first unread message

Nexxon

unread,
Apr 14, 2018, 6:26:38 AM4/14/18
to MIT App Inventor Forum
Hey everyone,

i am currently struggeling with my App that i developed using the  MIT App Inventor 2.
It's a game where you control a blue and a red Ball via Orientation Sensor. The goal is to bring the balls to their correspoding goal (goals are the squares) through a maze.
This goes on for 3 individual levels that i seperated into 3 Screens
Sounds pretty simple right? :D
However here comes my issue: For the first screen all works fine, the balls move properly without lag.
But when i finish stage one it needs plenty of time to load screen 2 and it is pretty unplayable. After a few seconds i can't move the balls at all.

Here comes my question: Does anyone have an idea how to fix this issue so i can play through the Screens without (too much) lag?
Maybe I am closing the screens wrong or something but i am really running out of ideas.

(Another problem i noticed is that if i flip my phone down and you are at the edge of the screen you can move through walls. Maybe someone also has an idea to fix that.)

I attached the logic and screens as picture since tha .aia is too big to upload here.

I would be really grateful if someone can help me!
maze1Screenshot.png
maze2Screenshot.png
LogicScreen1.1.png
LogicScreen1.2.png
LogicScreen2.png

TimAI2

unread,
Apr 14, 2018, 10:27:07 AM4/14/18
to MIT App Inventor Forum
1. For screens check you are switching correctly:

Use different screens wisely

If you decided to use different screens, then you should switch them correctly, else you will run out of memory after a while...      
The recommended method of switching screens in App Inventor
(Thanks Taifun)

Also see demo: multiscreen.aia

2. Not sure if you need to enable the orientation sensor again as you move to a new screen?

3. Not sure what is going on with your "timer"? can't see any clock enabled blocks ? Are you using a clock for this, if so how ?

Ghica

unread,
Apr 14, 2018, 4:30:32 PM4/14/18
to MIT App Inventor Forum
Why is your .aia too big to upload? How big is it?
Do you have images that are larger than necessary.?
Cheers, Ghica

Nexxon

unread,
Apr 15, 2018, 8:41:44 AM4/15/18
to MIT App Inventor Forum
Thanks for your response.
1. I decided to use a screen for each "level" because i didn't want to overload the blocks screen with logic. If i would only use one screen i have to do some if checks and rearrange the starting positions of the sprites/balls accordingly.
I checked your links on how to switch screens correctly and i think i am doing it right. I am always closing the current screen if i decide to switch to another screen.
2. True, thats unnecessary, i forgot to remove that.
3. Yes, the timer is a Clock component. The purpose of the timer is simply to display the current time needed for the game. The time adds up for each "level" and is displayed at the end for my "highscore screen".
I set the TimerInterval to the default of 1000 however the longer i am into the game the slower the time seems to update. It needs like 3-4 seconds but it only says 1second passed.
I suppose thats because of the general lag.

Nexxon

unread,
Apr 15, 2018, 8:45:26 AM4/15/18
to MIT App Inventor Forum
@Ghica
It is around 6MB. I got 3 MP3 sounds each around 1minute maybe thats the reason.
The squares are being scaled down in size a bit maybe i can optimize that but not sure if that will have a noticable impact.

nicoapps

unread,
Apr 15, 2018, 11:51:42 AM4/15/18
to MIT App Inventor Forum
Could you upload the aia file to e.g. Google Drive and send us the link to the file?
Thanks, Nico
Reply all
Reply to author
Forward
0 new messages