Using .XY in a Python script

This forum is currently in read-only mode.
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hey everyone,

    I'm new to Construct and Python so please be gentle.

    I have a very simple question. How do I set the XY position of an object using a Python script? I can set the X and Y positions separately, but how do I set them using the XY property?

    Setting the positions separately is easy:

    object.X = 0

    object.Y = 0

    Setting them together doesn't seem to work with any of these approaches:

    object.XY = {0,0}

    object.XY = [0,0]

    object.XY = (0,0)

    What syntax should I use?

    -Zumbooruk

  • Woops! I feel very silly now. I just spent more time wandering around the Wiki and found the answer. Instead of using XY, I should be using SetXY. XY is used for retrieving the X,Y position of an object and not for setting it. Yes?

    I guess the Wiki left me with one question: if .X can be used to change the position of an object, what's the point of SetX?

    These accomplish the same thing:

    object.X = 0

    object.SetX(0)

  • The more I think about this, the more it makes sense. Please disregard this thread and go about your business.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's a valid question, setting and getting .xy in python is incomplete and doesn't work. You can only set and get x and y individually.

    -cheers

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