Python and behaviors

This forum is currently in read-only mode.
  • Can Python access and/or modify behaviors? From what I've tried so far it does not seem to be possible.

    For example, if I want to change sprite[CustomMovement].XSpeed, how would I set that or get the value of in script?


  • that's correct.

    you can still use python though, with the python() expression

    Sprite - Custom Movement - Set X Speed to:

    if it gets messy, or you want to tweak it alot:
    an alternative is to set a python variable:
    Then in the event sheet:
    [b]Sprite  -  Custom Movement   -   Set X Speed to:[/b]
    for retrieving the value of Sprite[CustomMovement].XSpeed, the only thing I can think of is to set a private or global variable to Sprite[CustomMovement].XSpeed just before the script in the eventsheet, then using the variable in your script in place of the expression
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the example! I figured there would be syntax issues since the way Construct specifies Behaviors would clash with Python syntax, so this is a pretty good work around.

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