Events in Python

This forum is currently in read-only mode.
  • How do events work in the Python scripting?

    Let's say I have two types of objects, a Player and a Statue, and I put a script on them that fires when they collide.

    If I have two statues, how do I tell which one I just collided with?

    for s in Statue:
        if Player.Overlaps(s):
            .......
    [/code:z77wrael]
    
    This method doesn't seem to work as Overlaps never returns true, regardless of whether or not the two objects are actually overlapping.
    
    Then there's the OnCollide method in Python.  What does this do?  Is there a way to attach a callback to fire when this event fires?
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I finally found the answer here after much searching, in Construct-land this behavior is referred to as "picking".

    In the Python script editor, when you have a script that is a response to an event, then the objects involved in that event are part of the SOL object.

    In this case on a collision between the Player and a Statue

    SOL.Player is the player involved

    SOL.Statue is the statue involved

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