How do I make a pause without using Wait?

Get help using Construct 2

Post » Wed Oct 04, 2017 8:38 pm

Hi everybody, my problem lies in the fact that I've made a Family, which is basically making a sprite visible, but if I create the family and then set the family scale to say 2, the scaling doesn't work, the only way I can get it to work is to make a wait time of 0.001 seconds between creating the family and scaling the family for the scaling to take effect. Unfortunately this leaves a single frame where the family is scaled wrong and it's glaringly obvious.

https://imgur.com/PX1LbVY

Any workaround to this? I've tried putting the scale family as a sub-event to make a break without using the Wait, but it doesn't work, I can only get the scaling to work when I use a Wait event in between.
B
12
S
2
G
1
Posts: 47
Reputation: 781

Post » Wed Oct 04, 2017 8:45 pm

Why do you need a pause? Why isn't the scale working? Try on family created > set scale.
B
47
S
17
G
81
Posts: 2,224
Reputation: 48,095

Post » Wed Oct 04, 2017 9:24 pm

plinkie wrote:Why do you need a pause? Why isn't the scale working? Try on family created > set scale.


I'm not sure, it won't let me reposition the family or rescale it unless I leave a gap of some kind, it just defaults to the normal one. And I want to be able to change the scale on the fly in the same event sheet, so making a "on family created" for every scenario would be hell.

There must be some easy way to change a family's properties after creation without some kind of break for the code to register it?
B
12
S
2
G
1
Posts: 47
Reputation: 781

Post » Wed Oct 04, 2017 9:33 pm

There must be some easy way to change a family's properties after creation without some kind of break for the code to register it?


It's on family created. What do you mean by 'every scenario'? This one event covers every creation scenario.
B
47
S
17
G
81
Posts: 2,224
Reputation: 48,095

Post » Wed Oct 04, 2017 9:59 pm

plinkie wrote:
There must be some easy way to change a family's properties after creation without some kind of break for the code to register it?


It's on family created. What do you mean by 'every scenario'? This one event covers every creation scenario.


So if I use On Family Created> set position to X, then every time I create the family, it will be at that position. But I want to be able to change the position, it won't always be X, it will vary every time I create the family, I want that control. I'm finding it very hard to explain.

Let me put it another way, I've got a set of sprites that are all individual parts, but are parts of the same object, how would you go about spawning that object, along with all the parts in the right positions, and then scaling and positioning that object in its entirety once it's created? As you can see on that image, I made a function that creates all the individual parts and scales them. But if I call that function and then try and re-position it without a Wait in between the calling and re-positioning, it just stays in the original position.

So if I did On Family Created > set at this position, every time I create it it's going to be there, when in reality I want to be able to change the position afterwards to whatever I want, not just the same one every time it's created. Hopefully this somewhat makes sense. :oops: :oops: :oops:
B
12
S
2
G
1
Posts: 47
Reputation: 781

Post » Wed Oct 04, 2017 11:08 pm

You didn't mention anything about setting a position, you said you had an issue where set scale wasnt working. You can have an event on family created > set scale to x. For the position, you could use a function and pass a parameter through it for location. For your game it sounds like you need to use a container though, where you create an object made up of smaller objects that is premade.
B
47
S
17
G
81
Posts: 2,224
Reputation: 48,095

Post » Thu Oct 05, 2017 1:25 am

plinkie wrote:You didn't mention anything about setting a position, you said you had an issue where set scale wasnt working. You can have an event on family created > set scale to x. For the position, you could use a function and pass a parameter through it for location. For your game it sounds like you need to use a container though, where you create an object made up of smaller objects that is premade.


You know, I've just done a different method, where upon Creating an object, it creates another object. But, again, that secondary object's animation cannot be changed unless there's a wait before! I have no idea why this is happening on such a large scale on my project now, I literally have no idea what to do because if I create anything it needs a Wait before anything is repositioned, changed size, changed animation etc... :x :x
B
12
S
2
G
1
Posts: 47
Reputation: 781

Post » Thu Oct 05, 2017 2:00 am

How do you change that second object animation? Sprite->set animation or Family->Set animation?

When you create a sprite which is part of a family, you can't immediately refer to the Family in the same event if you want to change anything about this sprite. I think it's because this sprite hasn't actually been added to the family yet.
You need to wait a tick or use "On Family Created" event.

The problem with using "On Family Created" is that you can't pass any parameters to it (obviously), so here is a workaround. You can pass parameters to a function, where you pick family member by UID and then do whatever you want with it:
Image
Check out my awesome game Doptrix
B
17
S
9
G
50
Posts: 829
Reputation: 27,967


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 16 guests