Doh! ... Anyone fancy solving a maths problem... Before I redo it..

StormyStudioStormyStudio United KingdomMember Posts: 3,989
edited May 2014 in Working with GS (Mac)

OH Ffff.... DOH!

I hadn't given much thought to the repercussions to the way my home made grid spawns each square.

The grid starts at the bottom in the middle, and spawns above from left to right, going directly up the screen.

It works.

But now I want to be able to know the grid numbers for the squares adjoining any chosen square.

And cause I made it in a stupid way, I can't make the maths work.. So I'm gonna end up redoing it later tonight.

Had I made it so the grid was spawned in rows diagonally from bottom to top left and started again at the bottom for the next column it would be a whole lot easier. As it would go, 1,2,3,4,5,6,7,8,9,10 along one side and everything would be in nice tidy multiples of.

Out of interest, and as a pointless challenge. Can anyone see a pattern/formula that would give you the adjoining squares grid number.

For reference:
You have each cells given row and cell number. Plus their own grid number (which is the order in which they're currently spawned).

(in the end the grid might not be spawned at all, but until I settle on the preferred size it's nice to be able to quickly play around with values and test..)

Not the end of world re-making it and I will... but it's annoying me that I can't figure out some maths to make it work as is.

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Are you sure you want the squares numbered in this way? Wouldn't it be more useful to number them as a simple 2 dimensional array? (Its only your perspective that has shifted. The data structure is still a 2 dimensional array.)

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited May 2014

    @Rthurman absolutely, it just did'nt cross my mind when I first made the thing. (Also it looked quite cool when I had them 'bouncing into existence' from the bottom and working their way up).

    Fixed... this is how I want them numbered ... I err think...

    Only had to tweak the spawning rules a little bit in the end to get it to spawn in this order..

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Yes -- that's what I was trying to say.

    But I would probably number them in the opposite way -- so that node 11 would be numbered "2", and node 21 would be numbered "3" and so on. But maybe that's a perspective thing again. (It seems to me that the bottom row starts at 1 and then goes to the right.)

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989

    I think your right..

    Though actually to make it all the more normal to think through.

    I guess 1 should be in the top left (where 10) currently is.

    and 10 should be where 1 is, 20 where 11 is...

    it really should'nt be this hard... (I blame last nights pub quiz yet again)

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Yes, top left makes sense too.

    If last night's escapades are making things are a little hazy today, can I suggest you review a really brilliant template called 'Stormys GS Table-izer'? Its free! :)

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @RThurman said:
    If last night's escapades are making things are a little hazy today, can I suggest you review a really brilliant template called 'Stormys GS Table-izer'? Its free! :)

    lol!

    @StormyStudio It's great to see your triumphs and tribulations with this project. :smile:

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited May 2014

    @RThruman :blush: Do you actually ever make use of my Table-izer?

    @tatiang thanks... I think. :-)
    ...

    Here's the fixed thing... numbered a bit better again...

    Also made it so the first square can be positioned anywhere in the scene.. it's then snaps its position to a nice round number (getting rid of those pesky decimal points) and spawns the rest of the grid.

    note to self... when I try and leave the pub, don't succumb to offers of free beer.

  • FallacyStudiosFallacyStudios Member Posts: 970

    @Socks is who you need to have take a look. The guy is a math wiz.

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989

    @RThurman said:
    Yes, top left makes sense too.

    If last night's escapades are making things are a little hazy today, can I suggest you review a really brilliant template called 'Stormys GS Table-izer'? Its free! :)

    I really am having a slow day.. only now do I see what your getting at... spawning a big grid of cells successfully in a normal fashion.... Old me was much better than todays me.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @StormyStudio said:
    I really am having a slow day.. only now do I see what your getting at... spawning a big grid of cells successfully in a normal fashion.... Old me was much better than todays me.

    Yes!

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited May 2014

    @FallacyStudios‌ , you need @RThurman‌ if you need a practical math solution, you need @Socks if you also need the solution to work on a ferris wheel.

    aaand runs away

    sorry @Socks <3

  • SocksSocks London, UK.Member Posts: 12,822

    @Hopscotch said:
    FallacyStudios‌ , you need RThurman‌ if you need a practical math solution, you need Socks if you also need the solution to work on a ferris wheel.

    aaand runs away

    sorry Socks <3

    Lol ! :)

    There is a lot of truth to that !!

  • SocksSocks London, UK.Member Posts: 12,822

    @FallacyStudios said:
    Socks is who you need to have take a look. The guy is a math wiz.

    @RThurman is the man for this job !

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited May 2014

    Runs off to implement code... what the... a ferris wheel ? with lights and everything.. brilliant.. oh but no candy floss stall.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    "candy floss stall"

    What the...???

    Speak English man! Do you mean 'cotton candy stand'?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @RThurman said:
    "candy floss stall"

    What the...???

    Speak English man! Do you mean 'cotton candy stand'?

    He does. I had to Google it. Candy floss... what a name!

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989

    You guys and your crazy French.

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803

    Dropping a zip of a video of an old iso project I had. Don't have time right now to clean up the project for YouTube or marketplace. Not sure if there is anything still interesting to use in that. It needs to be updated for with the new GS when I get the time.

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989

    @CodeMonkey said:
    Dropping a zip of a video of an old iso project I had. Don't have time right now to clean up the project for YouTube or marketplace. Not sure if there is anything still interesting to use in that. It needs to be updated for with the new GS when I get the time.

    Thanks @CodeMonkey‌ strangely similar to my own thing. I like the fact you'd gone the same route with your spawned grid as I did at first.. from the middle and up.

    Now mines lined up in a normal array style it does make maths a whole lot easier.

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    edited May 2014

    spawning that way makes sense because it is easier to spawn them at the back of the layer so the older tiles are at the top and give it a nice layered effect.

    You can just use a table to figure out their correct row/column. That project pre-dates tables, so I didn't have that option.

  • SocksSocks London, UK.Member Posts: 12,822

    @StormyStudio said:
    You guys and your crazy French.

    Lol ! :smile:

    Look what these philistines have done to our language ! :p

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @Socks said:
    Look what these philistines have done to our language ! :p

    What are you people talking about? Everyone knows that the good old U. S. of A (especially the mountains of Appalachia) contains the truest forms of Shakespearean English.

Sign In or Register to comment.