Zumbooruk's Recent Forum Activity

  • Thanks, R0J0hound! You're my savior yet again.

    How did you know what it is? Is there a list somewhere which shows the Python equivalencies of all of the conditions and actions available on the event sheet? I often seem to run into the problem of knowing how to build something using the event sheet GUI but not knowing how to access the same properties, actions, etc. in a Python script. The Wiki is not very helpful in this regard.

  • Hey all,

    How do I access the "Has wall to right" condition (part of the Platform behavior) in a Python script? What is it called in the script editor?

    Any help would be greatly appreciated.

    -Zumbooruk

  • That's what I thought. Thanks for the clarification. I just wanted to be sure.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's there.

    For one of your conditions, click "New action." Choose the object you have the Physics behavior applied to. Go to the Physics tab. At the bottom, there should be a Velocity section with an option that says "Set velocity." It will ask you to input the X and Y components of velocity for the object.

    You can also read the object's velocity instead of setting it. If you want something to happen when the velocity in the x direction reaches a certain level, for example, you could do the following:

    Insert event --> System --> Compare --> select the "Value 1" field --> select the object from the list of objects at the bottom of the window --> go to the Physics tab --> choose "Get velocity x component"

    You can then choose the value to compare the x velocity to. When you're done, you'll have a new condition on the event sheet. You can then add actions to that condition which will execute when the condition is met.

  • Is it possible to toggle an object's Solid attribute on and off in a Python script? If so, how? Note: I don't want to change the collision mode to in effect "remove" the Solid attribute; I want to toggle the Solid attribute itself.

    Any thoughts?

    -Zumbooruk

  • Thanks! OverlapsOffset works perfectly.

    I was starting to go crazy. I was trying Overlaps with double quotes, single quotes, and without quotes -- none of which works.

    -Zumbooruk

  • I've run into a problem with the Overlaps condition in Python. In my test file, I've got a moving block (object1) and a stationary block (object2). When the moving block is overlapping the stationary block, I want a text object (text) to display "True." When the moving block is not overlapping the stationary block, I want the text object to display "False."

    I've gotten this to work using the normal events on the event sheet, but I want to do it using a Python script. I've tried the following, but it doesn't work:

    if object1.Overlaps(object2) == True:

    text.Text = "True"

    else:

    text.Text = "False"

    What am I doing wrong? The text object displays "False" even when object1 is overlapping object2. Overlaps doesn't seem to work how I expect it to. Does anyone have any suggestions about how to get this to work? Any help would be greatly appreciated.

    -Zumbooruk

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

  • 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)

  • 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

Zumbooruk's avatar

Zumbooruk

Member since 31 Aug, 2010

None one is following Zumbooruk yet!

Trophy Case

  • 14-Year Club

Progress

14/44
How to earn trophies