How do I

Get help using Construct 2

Post » Wed Aug 20, 2014 7:32 pm

I need this: when i click on object and this object is animation for example "animation5" then i want to change her animation to animation1 and change animation of another instance of this object (only one instance) to animation2 and change animation of another instance of this object to animation3, when is playing animtion2... Do you understand? I really do not know how to do it... please help me
B
25
S
4
G
2
Posts: 318
Reputation: 2,501

Post » Wed Aug 20, 2014 7:53 pm

It's a question of picking..

You can pick by comparison or by evaluate or random or pick all

so on object clicked
if object.animation = 3 - set animation to 1
system pick all objects
system pick random object - set animation to 2

well something like that, but it would be much easier if you were a bit clearer on what you want..
Should the animationchange be random, should the objects picked be random, how many objects should change animation, are the animations multiframe or could you just use one animation with frames, etcetera..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Aug 21, 2014 11:37 am

LittleStain wrote:It's a question of picking..

You can pick by comparison or by evaluate or random or pick all

so on object clicked
if object.animation = 3 - set animation to 1
system pick all objects
system pick random object - set animation to 2

well something like that, but it would be much easier if you were a bit clearer on what you want..
Should the animationchange be random, should the objects picked be random, how many objects should change animation, are the animations multiframe or could you just use one animation with frames, etcetera..


It is not so easy, i tried this too, but it doeas not work...
B
25
S
4
G
2
Posts: 318
Reputation: 2,501

Post » Thu Aug 21, 2014 2:28 pm

Like I said, It would be much easier if you were a bit clearer on what you want..

I guess it would be as easy as creating a function which can be used on any object clicked, but I haven't seen your events and or capx so it's like shooting in the dark..

Please share your capx, or create a new capx showing the issue, or make a screenshot of your events, so it is possible to see where the problem is..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Aug 21, 2014 3:21 pm

@Raiper341

I'm assuming you have an object with 5 animations that you want to cycle through when the object is touched. That is, when touched you go to the next animation and when it's on the last animation you go back to the first one.

Here is an example of how to do it:
Cycle Animation On Touch.capx
You do not have the required permissions to view the files attached to this post.
Find all the Construct 2 games that were on Steam Greenlight here
B
36
S
10
G
7
Posts: 477
Reputation: 7,019

Post » Thu Aug 21, 2014 3:22 pm

LittleStain wrote:Like I said, It would be much easier if you were a bit clearer on what you want..

I guess it would be as easy as creating a function which can be used on any object clicked, but I haven't seen your events and or capx so it's like shooting in the dark..

Please share your capx, or create a new capx showing the issue, or make a screenshot of your events, so it is possible to see where the problem is..

Here is picture of my latest try: https://www.dropbox.com/s/lq0l3jhqiane3 ... .21.00.png
But this change all instances to animation1....
B
25
S
4
G
2
Posts: 318
Reputation: 2,501

Post » Thu Aug 21, 2014 3:24 pm

OddConfection wrote:@Raiper341

I'm assuming you have an object with 5 animations that you want to cycle through when the object is touched. That is, when touched you go to the next animation and when it's on the last animation you go back to the first one.

Here is an example of how to do it:
Cycle Animation On Touch.capx

Panda thx, but i need when you click on instance with animation5 set random instance with animation1 to animation2, then another instance with animation2 set to animation3 ... I need affet next 3 objects for example. And this does not work for me :(
B
25
S
4
G
2
Posts: 318
Reputation: 2,501

Post » Thu Aug 21, 2014 3:35 pm

Ok..
I immediately notice 16 clones of the ghost object, which I don't understand..
They are probably all in the ghosts family, but wouldn't it be much easier just to use copies instead of clones?
Than you could pick random ghost instance instead of random family instance..
I would set the animation to "e"&ghost.instancevariable and just repeat picking a random instance 5 times and changing the variable to ghost.instancevariable+1 and setting the animation to "e"&ghost.instancevariable..
Maybe adding a boolean to make sure instances aren't picked twice during the repeat..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Aug 21, 2014 3:36 pm

By the way, putting this in a function would even be more convenient..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Aug 21, 2014 4:26 pm

LittleStain wrote:Ok..
I immediately notice 16 clones of the ghost object, which I don't understand..
They are probably all in the ghosts family, but wouldn't it be much easier just to use copies instead of clones?
Than you could pick random ghost instance instead of random family instance..
I would set the animation to "e"&ghost.instancevariable and just repeat picking a random instance 5 times and changing the variable to ghost.instancevariable+1 and setting the animation to "e"&ghost.instancevariable..
Maybe adding a boolean to make sure instances aren't picked twice during the repeat..

But how to use bolean? I do not know, maybe this is the problem...
B
25
S
4
G
2
Posts: 318
Reputation: 2,501

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests