My Frustration

For questions about using Classic.

Post » Fri Feb 08, 2008 12:54 pm

This issue is highlighted in big white letters on a pink background in the comments of the following CAP file!

http://rapidshare.com/files/90131346/Quarto.cap.html

What am I doing wrong? Have I missed some crucial piece of Construct logic?
B
2
G
5
Posts: 10
Reputation: 1,270

Post » Fri Feb 08, 2008 1:25 pm

[quote:mpbnd39w]Have I missed some crucial piece of Construct logic?[/quote:mpbnd39w]

Yes. You used 'Compare values' in the system object to compare the 'ID' private variable of a piece, instead of using the Piece sprite's own 'Compare private variable' condition.

'Compare private variable' will check every piece and pick the ones that meet the condition for the event. 'Compare values' does not: it simply works out the first value, the second value, and does a simple comparison without caring about which objects were used to calculate the first and second values. It doesn't do any object picking.

So you should prefer using the conditions in the object rather than Compare Values, at all times. However, another solution is to add a 'For Each Piece' condition above the Compare Values, which explicitly forces the event to check every Piece instance - however, this is the long way of writing a simple 'Compare private variable' condition!
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Fri Feb 08, 2008 1:34 pm

cool beans. Thanks Gullen.
B
2
G
5
Posts: 10
Reputation: 1,270

Post » Sat Feb 09, 2008 1:25 am

While the previous fix worked. Its still not consistent for me trying to modify the properties of one sprite and that of all the sprites. Either there is something wrong with my loop. Or again I've missed some logic, but I cant work it out!

I want each instance of the sprite to load a different image, instead they all load image 16. However the loop does the ID variable correctly.

All the files are included in the following RAR.

http://rapidshare.com/files/90288989/Quarto.rar.html

Whats going on? please assist.
B
2
G
5
Posts: 10
Reputation: 1,270


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests