Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Need a little formula

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Ysoft_Entertainment
VB Programmer




Joined: 23 Sep 2003
Posts: 810
Location: Wherever There is a good game.

PostPosted: Tue Apr 15, 2008 6:43 am    Post subject: Need a little formula Reply with quote

Ok here is what I need

the situation:
I have a 7,7 array, like so

1 2 3 4 5 6 7
1
2
3
4
5
6
7

how would get 2,2 coordinates from 9?

to get 9 you can do this ((2-1)*7)+2. I just don't know what formula to use to get 2,2 from back from 9.
_________________
Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Tue Apr 15, 2008 9:59 am    Post subject: Reply with quote

First of all, your array should be 0-6, otherwise this gets confusing fast.

- 0 1 2 3 4 5 6
0 \ |
1 - X
2
3
4
5
6

Better. So (1,1) would be 1*7+1 = 7. (2,2) would be 2*7+2 = 16.

Your formula in reverse would be:
coord1 = n mod 7
coord2 = n / 7
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
Ysoft_Entertainment
VB Programmer




Joined: 23 Sep 2003
Posts: 810
Location: Wherever There is a good game.

PostPosted: Tue Apr 15, 2008 10:28 am    Post subject: Reply with quote

Thanks moogle.
_________________
Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group