How do I exclude a sprite from the frame loop?

0 favourites
  • 10 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • Hi,

    I want to exclude a sprite completely from the frame-loop in order to "freeze" is under certain conditions. Can it be done simply?

    thanks

  • Create the same animation loop under a different name and leave out the frame you want excluded and call that animation when needed.

  • Thanks but I´m afraid I misdescribed it. I did not mean the animation loop but the frame loop. The sprite eventsheet should be ignored and the sprite should remain at the last rendered animation frame (become "static"). Something like: "Exclude eventsheet but don´t kill the object".

    Anyone?

  • Thanks but I´m afraid I misdescribed it. I did not mean the animation loop but the frame loop. The sprite eventsheet should be ignored and the sprite should remain at the last rendered animation frame (become "static"). Something like: "Exclude eventsheet but don´t kill the object".

    Anyone?

    Then use a global variable trigger that you set so that event is not run.

  • Hi,

    I am not sure what you mean. The event-sheet for this object has a lot of events and I want do "deactivate" all of them. I thought there would be a simple solution like "decouple the eventsheet from the object"

    greetings

  • Hi,

    I am not sure what you mean. The event-sheet for this object has a lot of events and I want do "deactivate" all of them. I thought there would be a simple solution like "decouple the eventsheet from the object"

    greetings

    The way to exclude an event from happening is to use a global variable trigger.

    Use a second condition on the event and check if the variable has been triggered.

    Global Variable Trigger = 0

    Event do something: change sprite

    Trigger = 0

    On event: Set Trigger = 1

  • Hi,

    the equivalent in pseudo code would be something like:

    method a
    {
        if (trigger)
        {
          return;
        }
    
        (...)Do something funky
    }
    
    method b
    {
        if (trigger)
        {
          return;
        }
        
        (...)Do something funky
    }
    [/code:2rxzhb32]
    
    This would be called "bad coding style" I guess. There must be a better way...
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    the equivalent in pseudo code would be something like:

    > method a
    {
        if (trigger)
        {
          return;
        }
    
        (...)Do something funky
    }
    
    method b
    {
        if (trigger)
        {
          return;
        }
        
        (...)Do something funky
    }
    [/code:3fay70jv]
    
    This would be called "bad coding style" I guess. There must be a better way...
    

    Ok well good luck with that and using global variables is not bad coding style.

    I won't bother myself helping you in the future.

  • Something like: "Exclude eventsheet but don´t kill the object".?

    You can't exclude Event sheets, but you can disable multiple Events using Groups.

    Add a Group to your Event sheet and move the Events into the Group.

    When you want to stop the Events running, use the action System: Set group active, select the Group and set it's state to Deactivated.

  • That´s pretty much what I was looking for... thanks. I used groups before and even used the activate/deactivate function but it did not come into my mind.

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