I do not understand the result of the condition.

Discussion and feedback on Construct 2

Post » Mon Dec 05, 2016 10:34 am

Hi, what is the reason why the condition is false if I compare the name of the animation but it is true if I use "pin is pinned" ?.

I do not understand :?

Image

Image

https://dl.dropboxusercontent.com/u/60803633/testEstrellas.capx
B
29
S
12
G
21
Posts: 801
Reputation: 14,453

Post » Mon Dec 05, 2016 10:47 am

the system: compare two expressions does not pick objects, that may be your issue right here, as with the pin, it'll work.

I tried a system: pick by comparison instead and it worked.

however I am still unsure how that is supposed to work without picking so I may investigate further.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Mon Dec 05, 2016 1:13 pm

Mirlas wrote:Hi, what is the reason why the condition is false if I compare the name of the animation but it is true if I use "pin is pinned" ?.

I do not understand :?

Image

Image

https://dl.dropboxusercontent.com/u/60803633/testEstrellas.capx


I have no idea why that does not work, but if you want to pick the star by it's animation, this should work:
star - Is playing animation "Default2" => [action]
ImageImageImageImage
B
30
S
9
G
7
Posts: 245
Reputation: 5,602

Post » Mon Dec 05, 2016 4:12 pm

Sure, there are other ways to do it but I think that condition should work, I hope someone can clearly explain why the condition does not work


Star.AnimationName = "Default2"
B
29
S
12
G
21
Posts: 801
Reputation: 14,453

Post » Mon Dec 05, 2016 4:15 pm

It's because you have a bunch of star objects. If you just say "is star.animationname=default2" how should it know which start to pick?

Use "for each". For each star object -> star animation is = to default2 -> rotate.
B
124
S
43
G
41
Posts: 849
Reputation: 28,235

Post » Mon Dec 05, 2016 4:25 pm

C2 should pick up the star that has the animation named "Default2".

Is not that how it works?
You put a condition, then the objects that fulfill it pass the condition and are collected.
B
29
S
12
G
21
Posts: 801
Reputation: 14,453

Post » Mon Dec 05, 2016 4:54 pm

(As already said) The condition 'Compare two values' has no 'pick' component. Only a logic component. It is true or untrue, and thats it.
The star the action is addressed to is therefor unreferenced.

If you wanna use an object related expression in the Compare two values (Sprite.X, Sprite.AnimationName, etc) then you have to pick that sprite first. Unless there is only 1 instance of that object. Unless you are only interested in the object with the lowest IID when all are picked.

The condition 'Is pinned' has a 'pick' component and a 'logic' component.
Its picks all the stars that are pinned.
Its true when the picklist is not empty, it is untrue when there is none picked.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Dec 05, 2016 7:12 pm

Thanks, it's a bit clearer, but at the same time it seems a bit strange that objects are not collected using that kind of condition.
B
29
S
12
G
21
Posts: 801
Reputation: 14,453

Post » Mon Dec 05, 2016 7:35 pm

Mirlas wrote:Thanks, it's a bit clearer, but at the same time it seems a bit strange that objects are not collected using that kind of condition.


There is the system condition "Pick by comparison" which is more or less the same exact thing but can pick objects, compare two values just compare two values, without any picking as it is not designed to be used that way.

The picking system is one of the most important part of C2, however not every condition can pick objects.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Mon Dec 05, 2016 7:41 pm

I have to admit, it is not that clear, Mirlas.
I learned by using.

In general, conditions are part 'picking' and part 'logic'.

I think all conditions you find under 'sprite' do pick objects and do have a logic part.
Except the triggers, they have not a realy logic part, that is why you can not combine them with an 'else'. They just fire and pick.

The conditions under system do pick when they start with 'pick', or when they start with 'for each'.

Roughly that could help you.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Baidu [Spider] and 27 guests