Quick Links: Gideros Home | Download Gideros | Developer Guide
SetAnchorPoint error on android Gideros Player
  • 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.

    984 x 452 - 28K
  • 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
  • pie +1 -1
    @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?
  • pie +1 -1
    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 +1 -1
    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)

    If ring is just a sprite then that is most likely the cause of issues.
    Check out my DevBlog, my GitHub, and my games Falling Animals | Breaky Wall | Exetor

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with OpenID

In this Discussion

Top Posters