tag:blogger.com,1999:blog-3697740652085247598.post3637268835750076175..comments2022-03-03T13:31:16.243-08:00Comments on Codea Tutorials: Tutorial 15 - A* Path FindingDavid Suchhttp://www.blogger.com/profile/10502842288604398442noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-3697740652085247598.post-17539935343508676022013-02-24T06:12:16.280-08:002013-02-24T06:12:16.280-08:00Thanks David,
I'll try that !
GodzilaThanks David,<br />I'll try that !<br /><br />GodzilaAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-3697740652085247598.post-7190641394461820512013-02-23T14:09:49.694-08:002013-02-23T14:09:49.694-08:00Hi Anonymous,
Thanks for the feedback. I think th...Hi Anonymous,<br /><br />Thanks for the feedback. I think the issue is that the latest version of Codea (v1.5) has changed the order that functions are run. The function orientationChanged() now gets called before setup, so if you try to access variables in orientationChanged() which are defined in setup(), it is a problem. This is the way that the Lua code works in the runtime, so it makes sense to have it consistent.<br /><br />The fix is simple:<br /><br />1. At the start of the program in the Main tab (just beneath the line supportedOrientations(ANY), add a new boolean as follows:<br /><br />setupHasRun = false<br /><br />2. In setup() add the following as the last statement before the closing end:<br /><br />setupHasRun = true<br /><br />3. Finally, in the function orientationChanged(newOrientation), make the following changes:<br /><br />function orientationChanged(newOrientation)<br /><br /> if setupHasRun then<br /><br /> -- This way we don't try to update the grid location until after setup()<br /> -- has been run. Note that updateGridLocation() calls spriteSize which <br /> -- is defined in setup().<br /><br /> updateGridLocation(newOrientation)<br /><br /> end<br /><br />endDavid Suchhttps://www.blogger.com/profile/10502842288604398442noreply@blogger.comtag:blogger.com,1999:blog-3697740652085247598.post-616549332012219202013-02-23T13:26:24.979-08:002013-02-23T13:26:24.979-08:00Hi,
Thanks a lot for all ur tutos.
I have a pb wit...Hi,<br />Thanks a lot for all ur tutos.<br />I have a pb with this one.<br />An error msg on line 168 : attempt to perform arithmetic on global 'spriteSize' ... I stop and then I click on run (remote buttons on the left) and it works ... A problem with my Codea ?Anonymousnoreply@blogger.com