Really bogus reading from array issue [SOLVED!]

For questions about using Classic.

Post » Wed Jan 19, 2011 2:48 am

[quote="newt":11c71dkz][quote:11c71dkz]Does a construct array have any of those restrictions?[/quote:11c71dkz]

That I don't know, but you can always use int(), or str() applied to what you retrieve from your array to be sure.
Other than that, I don't know what to tell you... frame rate issue? :P[/quote:11c71dkz]
You may store text and numbers mixed in an array. Every array "cell" keeps the information if the data is a number or a text ([Array: Set index 1 to 20] stores the number 20, [Array: Set index 2 to "20"] stores the text "20")

EDIT: When running without debugger the result of 2 * Array(2) is 2 instead of 40, because multiplying the text is an error and therefore the text is treated as nothing.
Posts: 1,821
Reputation: 8,289

Post » Wed Jan 19, 2011 4:14 am

the int() was the issue. without that, it thought the number was text, even though it was showing a number.

I am really glad because I was attempting to recreate this in MMF2, and while i had the animation engine perfect, creating something like an 8 directions movement is just trouble. Sorry for getting so frustrated everyone, and thanks for the help, I really appreciate it. So if anyone else has an issue like this (using mixed arrays), just tell them to convert just to be sure.

[quote:1x95mh6c]This isn't true. The fact that you use whole numbers doesn't make them integers. All numbers in Construct are always floats, and floats can get imprecise even when just calculating with whole numbers. That's due to the structure of floats.[/quote:1x95mh6c]

That's what I meant, I just was an idiot with my terms.
Posts: 38
Reputation: 676


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest