How do I check if an origin point exists ?

  • Is there any way i can check if a certain sprite has an origin point which has the same name as something else ? ( basically , compare the name of an origin point )

    Ex :

    - If Object Sprite has an origin point named "Test" :

    return true

    else

    return false

    end

  • I think you mean imagepoint? All objects have an origin and I didn’t think you could rename it.

    If you just access an imagepoint x or y with an expression and if it’s equal to 0 the will mean it doesn’t exist. Usually at least, if you have the sprite near the top left edges of the layout the imagepoint could have zero coordinates. In that case you’d want to move the sprite to a location far away first, then after your check move it back.

  • Origin image point (image point #0) always exists, and you can't rename it.

    If you want to check if another image point with a specific name exists, there is no straightforward way to do this.. If you are sure that the image point "Test" is not set at the same position as the origin, you can do this check:

    Sprite.ImagepointX("Test")<>Sprite.x or Sprite.ImagepointY("Test")<>Sprite.y

    If the result is true, this means the image point "Test" does exist.

    R0J0hound I tested just now and seems like if you try to access ImagepointX or ImagepointY for a non-existing image point, these expressions return coordinates of the origin point, not 0.

  • dop2000

    Ah, I hadn’t tested it, good to know. I guess in that case it would be a false positive if the imagepoint was actually the same as the origin.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you all very much , it worked :) .

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)