Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
SetAnchorPoint error on android Gideros Player — Gideros Forum

SetAnchorPoint error on android Gideros Player

augustino_fpaugustino_fp Member
edited July 2017 in Bugs and issues
Hi all,
I recently have been trying to test my mobile app on a physical android rather than just the windows Gideros Player. My code runs fine on my computer with no errors, however when I tried to test it on the mobile device today, I received the following error: attempt to call method 'setAnchorPoint' (a nil value). I have run into these types of errors before while developing in lua, but since the same error did not occur on my computer I was wondering if this was a problem people were aware of? I have attached my code if it will help (error occurs on line 48), but I want to first make sure this problem is not common, or easily fixable. Thanks for any information you can provide!

EDIT: I just realized lines are not numbered in the attached file: i have attached a picture showing which line produces the error.

lua
lua
load.lua
2K
anchor_error.PNG
984 x 452 - 28K

Comments

  • UPDATE: I have just commented out the setAnchorPoint line and the game runs with no errors on my device... I'm very confused at this point lol
  • piepie Member
    @augustino_fp are you using giderosCodingEasy libs (https://github.com/ar2rsawseen/GiderosCodingEasy)?

    As far as I know there is no setAnchorPoint method in Sprite by default, but I think that you may use http://docs.giderosmobile.com/reference/gideros/Sprite/setAnchorPosition

  • Hmm, I must be because setAnchorPoint has been working on my computer Gideros player... I don't recall downloading it but I may have forgotten. Is there a way to incorporate this on my mobile device?
  • piepie Member
    yes, this sounds strange :)
    if you are using it you should have it in your project tree on the left of the gideros ide: I believe you should do nothing else to incorporate it, just make sure it's loaded at the beginning (at least before load.lua) in the "code dependencies/call order" tab.
    Maybe the device is slower than the computer loading files.. just guessing :)
  • Ok, thanks for your help. I'm just going to hope someone has run into this before.
  • antixantix Member
    Try changing your code like so..
      if(j == 1) then --if we are on the first block of the current ring
        blocks[j]:setAnchorPoint(0.5, 0.5)
        ring[i]:setPosition(origin_x, origin_y)
      end
    If ring is just a sprite then that is most likely the cause of issues.
Sign In or Register to comment.