How is this possible? See code...

Get help using Construct 2

Post » Mon Dec 14, 2015 12:44 am

locohost wrote:Ok that's interesting. I changed the System Compare Frame to FamCard Compare Frame, as you suggested. Now the very first flip does work on the card hovered. But then subsequent flips work on another (not the one hovered) card. So I'll say that's a good step.

Also, I think we're disconnected on the UID question. Will all Card.UID values be the same on each player's running instance? We could assume that every player has the exact same version of the exported app, but it's possible they may not. How can UIDs be guaranteed to match for all players
?


Why would they need to be if you are only using it to reference an already picked object?

for example:

on object clicked
> call function with parameter object.uid

will always call the function for the right object, regardless of it's uid..
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 » Mon Dec 14, 2015 1:08 am

www.blackhornettechnologies.com/Constru ... dFlip.capx
What you have should work. You probably are safest using fixed GUIDs to sync between two clients.
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198

Post » Mon Dec 14, 2015 4:04 am

Actually the object's uids will be the same on any computer you run the exported project on. You can easily test this. The only fuzzy part I guess would be if you create any objects at runtime, but even then if you ensure you create the objects in the same order then they would be the same.

The values for the uid are very predicable too. The first object has a uid of 0, the second: 1, and so on.

My point is a guid sounds unnecessary.
B
94
S
33
G
118
Posts: 5,393
Reputation: 75,847

Post » Mon Dec 14, 2015 5:33 pm

@R0J0hound All of the Card sprites are created runtime from Xml data. The configuration Xml is on a server. So that GUID is in the Xml which means I know, with 100% certainty, all Cards on every client have the same GUIDs. They will always be picked correctly and sync'd correctly.

If there is a compelling reason, say a performance reason or similar, I could switch to UID, but I'd rather stay with what I have unless it's somehow "bad".
B
14
S
4
Posts: 300
Reputation: 1,643

Post » Mon Dec 14, 2015 7:18 pm

It was just an idea. No need to switch, and using a guid would be better if you run multiple games.
B
94
S
33
G
118
Posts: 5,393
Reputation: 75,847

Post » Mon Dec 14, 2015 7:34 pm

R0J0hound wrote:It was just an idea. No need to switch, and using a guid would be better if you run multiple games.

I wasn't sure if maybe Pick by UID is faster code than Pick by InstVar = ???
B
14
S
4
Posts: 300
Reputation: 1,643

Post » Mon Dec 14, 2015 9:28 pm

It is faster but I'd go with what was more readable.
B
94
S
33
G
118
Posts: 5,393
Reputation: 75,847

Post » Sun Dec 27, 2015 10:52 pm

Ok I resolved the issue. This code works and seems to indicate a C2 bug...

Image

Compare to code in OP to see where the bug is. The 2nd level pick by FamCard in the OR condition is picking instances outside of the 1st level pick. This should not happen.
B
14
S
4
Posts: 300
Reputation: 1,643

Post » Sun Dec 27, 2015 10:59 pm

locohost wrote:Ok I resolved the issue. This code works and seems to indicate a C2 bug...

Image

Compare to code in OP to see where the bug is. The 2nd level pick by FamCard in the OR condition is picking instances outside of the 1st level pick. This should not happen.


Isn't this exactly what I was talking about?
"System compare two values" doesn't pick..
In these "new" events you aren't referencing any familycards in the "system compare" condition..

In the OP, you had the frame compare of the familycard in a system compare..
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 » Sun Dec 27, 2015 11:27 pm

LittleStain wrote:Isn't this exactly what I was talking about?

Mmm, with respect, no I don't think so :-)

The trick (for this bit of code anyway) has nothing to do with the AnimationFrame check and everything to do with the subsequent FamCard.PlayerIdx checks in the nested OR Event. I can do a single FamCard.PlayerIdx = Player_MyIndex in the nested Event and the code works fine, but as soon as you add the second OR'd conditional using the Family instance var, sprite instances outside the original pick then become picked somehow. I think it's a bug.
B
14
S
4
Posts: 300
Reputation: 1,643

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests