4 hours horror with simple actionscript?

  • neostart
  • Born
  • Born
  • neostart
  • Posts: 1

Post 3+ Months Ago

I have a 35 stones with letters from 1 to 35.

The can be only 7 stones on a row.

I count from 1 to 35 and place them, till I get the 8th stone, which must be placed in the next row.

If the position of some stone is "x", the counted number is "i" and the width of the stone is "w",

tell me please, what's the equation to reset the "x" of the particular stone and be able to put another one, next to him.

I tried to build equation myself, but without success:

Code: [ Select ]
if (stone.x > 100) do

stone._x=0;

else

stone.x = stone.x + i * stone.width._width;
  1. if (stone.x > 100) do
  2. stone._x=0;
  3. else
  4. stone.x = stone.x + i * stone.width._width;



The key is, I want to create chessboard from stones, when I know, that I know the "i" letter is going from 1 to 35.

I always get stones clips positioned as below:

ooooooo
_______ooooooo
______________ooooooo

so, I missed the equation somewhat...
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • nornholdj
  • Novice
  • Novice
  • User avatar
  • Posts: 18

Post 3+ Months Ago

Use the modulous funtion on "i". I believe that you would want to use:
Code: [ Select ]
if(stone.i%7 == 0)//this detects when you should jump to the next line
{
    //here you would want to reset stone.x to its starting position to reset the row
    //if 0 was your starting position
    stone._x = 0;

    //then increment the "y" value so that the next stone shows up on the next row
    //assuming that the height is the same as the width (like most chessboards)
    stone._y += stone._w;
    
    //you should have successfully positioned your first stone in the second row.
    //from here use the new "y" value for the rest of this row and then increment "x" by "w"
    //then for your next row this should be called again.
}
  1. if(stone.i%7 == 0)//this detects when you should jump to the next line
  2. {
  3.     //here you would want to reset stone.x to its starting position to reset the row
  4.     //if 0 was your starting position
  5.     stone._x = 0;
  6.     //then increment the "y" value so that the next stone shows up on the next row
  7.     //assuming that the height is the same as the width (like most chessboards)
  8.     stone._y += stone._w;
  9.     
  10.     //you should have successfully positioned your first stone in the second row.
  11.     //from here use the new "y" value for the rest of this row and then increment "x" by "w"
  12.     //then for your next row this should be called again.
  13. }


This if statement would be placed in some kind of loop and it will only detect the first stone in a row but all of the other stones are relative to that one.

Let me know if that doesn't make sense. I might not be understanding you correctly.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 17 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.