How do I exclude a sprite from the frame loop?

Get help using Construct 2

Post » Tue Mar 14, 2017 9:05 pm

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
B
4
Posts: 14
Reputation: 276

Post » Tue Mar 14, 2017 9:33 pm

Create the same animation loop under a different name and leave out the frame you want excluded and call that animation when needed.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Wed Mar 15, 2017 7:56 am

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?
B
4
Posts: 14
Reputation: 276

Post » Wed Mar 15, 2017 8:18 am

Gumbo wrote: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.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Wed Mar 15, 2017 8:37 am

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
B
4
Posts: 14
Reputation: 276

Post » Wed Mar 15, 2017 8:39 am

Gumbo wrote: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
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Wed Mar 15, 2017 9:29 am

Hi,

the equivalent in pseudo code would be something like:

Code: Select all
method a
{
    if (trigger)
    {
      return;
    }

    (...)Do something funky
}

method b
{
    if (trigger)
    {
      return;
    }
   
    (...)Do something funky
}


This would be called "bad coding style" I guess. There must be a better way...
B
4
Posts: 14
Reputation: 276

Post » Wed Mar 15, 2017 9:36 am

Gumbo wrote:Hi,

the equivalent in pseudo code would be something like:

Code: Select all
method a
{
    if (trigger)
    {
      return;
    }

    (...)Do something funky
}

method b
{
    if (trigger)
    {
      return;
    }
   
    (...)Do something funky
}


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.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Wed Mar 15, 2017 10:35 am

Gumbo wrote: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.
Find all the Construct 2 games that were on Steam Greenlight here
B
33
S
9
G
7
Posts: 451
Reputation: 6,782

Post » Thu Mar 16, 2017 7:44 am

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.
B
4
Posts: 14
Reputation: 276


Return to How do I....?

Who is online

Users browsing this forum: beohs, Blendi1223, Elliott, MadSpy and 11 guests