Math question: storing 2 numbers in one

Get help using Construct 2

Post » Fri Mar 10, 2017 9:10 pm

I was having a similar problem and being quite stubborn I was convinced there was a mathematical solution to this and I found one that works for me.

My problem was storing a bunch of x,y coordinates into a flat list that I could easily reference. I though of the two main ideas posted here and was about to give in to bit shifting when I found something you may be able to put to use. The trick is simple, use a prime number in the equation;

number = x + prime * y

hope this helps.
B
1
Posts: 1
Reputation: 127

Post » Sat Mar 11, 2017 6:18 am

@akrfranko

interesting..

so what is the unpacking formula?

160, 5001

compress:
160 + (3 * 5001) = 15,163

uncompress:
?
B
97
S
32
G
15
Posts: 1,191
Reputation: 16,164

Previous

Return to How do I....?

Who is online

Users browsing this forum: R0J0hound and 6 guests