Skip to first unread message
Assigned to joshes...@gmail.com by taifu...@gmail.com

y.ahm...@gmail.com

unread,
Jul 11, 2014, 2:50:00 AM7/11/14
to mitappinv...@googlegroups.com
I'm at part 3 of the tutorial. It looks like everything is set up how it should be in the blocks, and the ball works with the tee and arrows at the start, but after that the ball never uses them again. The strokes for "this hole:" will also stay the same, until the ball gets moved again for the first time.

Enis

unread,
Jul 11, 2014, 2:53:41 AM7/11/14
to mitappinv...@googlegroups.com
Please post a screenshot of your pertinent blocks...

y.ahm...@gmail.com

unread,
Jul 11, 2014, 3:05:39 AM7/11/14
to mitappinv...@googlegroups.com
Here's the screenshot.
Screenshot from 2014-07-11 02:01:13.png

Sinbad WhiteLine

unread,
Jul 11, 2014, 8:53:46 AM7/11/14
to
I had the same problem. I decided to continue the tutorial until i reached the new button code then its fixed.
There still is a problem though and i think its a race condition in the "prepareScreen" procedure. The first time the game loads, the Tee and sometimes the left and right arrows are not where they should be. After tinkering around i found out (only when the app starts not when u press new game) that the Tee depends on the initial canvas width and height in the designer page not the "set Canvas1.Height to Screen.Height - 100" just before it.
btw I'm using Galaxy Note 3 and i think the speed and multi-threading capability of the device is causing this problem. if there is a way to make methods STATIC (which i didnt find out how to do in app inventor 2) i think this would be solved.
I appreciate any feedback on this and any solutions on how to set the contents sizes relatively to Screen size (to be prepared for all smartphone and tablet sizes).
Thank you

Taifun

unread,
Jul 11, 2014, 9:37:16 AM7/11/14
to mitappinv...@googlegroups.com
 The first time the game loads, the Tee and sometimes the left and right arrows are not where they should be. After tinkering around i found out (only when the app starts not when u press new game) that the Tee depends on the initial canvas width and height in the designer page not the "set Canvas1.Height to Screen.Height - 100" just before it.

@Sinbad this is a timing problem as you correctly found out
you can fix that using a clock component: in the designer set the timer interval to lets say 10 milliseconds and timer enabled = false
then in the blocks editor in the prepareScreen procedure use only the 2 canvas blocks and start the timer: set clock.TimerEnabled = true
all other blocks from the prepareScreen procedure put them into the Clock.Timer event and set clock.Timer.Enabled = false again

how to set the contents sizes relatively to Screen size (to be prepared for all smartphone and tablet sizes
do a search in the forum, Gareth just posted something about this recently 

@y.ahm: unfortunately I did not understand your problem, to provide only the relevant blocks in the screenshot could have helped...
Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

Sinbad WhiteLine

unread,
Jul 11, 2014, 1:37:05 PM7/11/14
to mitappinv...@googlegroups.com
Thank you so much Taifun ^^ your reply was so helpful.
I tried to find the Gareth post that u referred to but couldn't. I would really appreciate it if u could post the link.
Either way you've been great ^^

Taifun

unread,
Jul 11, 2014, 2:08:29 PM7/11/14
to mitappinv...@googlegroups.com

y.ahm...@gmail.com

unread,
Jul 11, 2014, 3:58:22 PM7/11/14
to mitappinv...@googlegroups.com
Thanks my problem seems to be the same as yours, and my phone is Nexus 5. I went further in the tutorial too and noticed my sprites also weren't placed where they should be, until I press new game.

Taifun, I mean after the ball goes in the hole and the ball gets reset, it no longer functions with the arrows for the tee. It works now after I use the new game button, and still works after the ball goes in the hole. The other problem is with the current score. For how many strokes it takes to get the ball in the hole, it still stays the same after the ball gets reset, but it updates to 1 after moving the ball again for the first time. Also the starting position for the ball is a little to the right on the tee. I downloaded the sample and tried it and still had the same problems. This also is my first tutorial I tried after the 3 beginner ones, so I'm going to try out some of the other basic ones instead.
Reply all
Reply to author
Forward
0 new messages