This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
int a,b,c,i;
int Rainbow[10]; // Just use 0 - 6 for final values
//create unique values
for (i=0;i<10;i++)
{
Rainbow[i]=i;
}
for (i=0;i<50;i++) //Amount of mixing up
{
//swap two random elements
a=Random(10);
b=Random(10);
c=Rainbow[a];
Rainbow[a]=Rainbow[b];
Rainbow[b]=c;
}
function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
{
Ã, Hotspot* Hot;
Ã, Region* Reg;
Ã, if (button==eMouseLeft)
Ã, {
Ã, Ã, Ã, Hot=Hotspot.GetAtScreenXY(mouse.x,mouse.y);Ã,Â
Ã, Ã, Ã, Reg=Region.GetAtRoomXY(mouse.x, mouse.y);
Ã, Ã, if (Hot.ID!=0 && Reg.ID!=0)
Ã, Ã, {
Ã, Ã, Ã, Ã, BoardSquareX=Hot.ID-1;
Ã, Ã, Ã, Ã, BoardSquareY=Reg.ID-1;
Ã, Ã, Ã, Ã, ClickOnBoard=true;
Ã, Ã, }
Ã, Ã, else
Ã, Ã, {
Ã, Ã, Ã, ClickOnBoard=false;
Ã, Ã, }
}
ky=1.0-(IntToFloat(SY)-81.0)/(220.0-81.0); //ky=1.0 at bottom, ky=0.0 at top
//81.0 is vertical centre of top row
//220.0 is vertical centre of bottom row
Ã, kx=(IntToFloat(x))/(IntToFloat(BoardSize-1));
float BX0=58.0;Ã, Ã, Ã, Ã, //X value centre top left square
float BX1=256.0;Ã, Ã, Ã, //X Value centre top right square
float BX2=20.0;Ã, Ã, Ã, Ã, //X Value centre bottom left square
float BX3=299.0;Ã, Ã, Ã, //X Value centre rottom right square
int SX;Ã, Ã, Ã, Ã, //Final Screen X
int SY;Ã, Ã, Ã, Ã, //Final Screen Y
float SScale;Ã, Ã, //Scale of piece for mock 3D effect
function ScreenXY(int x, int y)Ã, Ã, //Board (x,y)Ã, Ã, (0,0) is top left
{
Ã, if (y==0) SY=220;Ã, Ã, //Get Screen Y values for vertical centre of each square
Ã, if (y==1) SY=195;
Ã, if (y==2) SY=171;
Ã, if (y==3) SY=150;
Ã, if (y==4) SY=129;
Ã, if (y==5) SY=110;
Ã, if (y==6) SY=94;
Ã, if (y==7) SY=81;
Ã, //Calculate Screen X values assuming linearly spaced squares
Ã, float kx;
Ã, float ky;
Ã, float x0;
Ã, float x1;
Ã,Â
Ã, ky=1.0-(IntToFloat(SY)-81.0)/(225.0-89.0);Ã, //ky=1.0 at bottom =0.0 at top
Ã,Â
Ã, x0=BX2+ky*(BX0-BX2);
Ã, x1=BX3+ky*(BX1-BX3);
Ã,Â
Ã, kx=(IntToFloat(x))/(IntToFloat(BoardSize-1));
Ã, SX=FloatToInt(x0+kx*(x1-x0));
Ã,Â
Ã, SScale=(100.0+(70.0-100.0)*ky)/100.0;Ã, //Scale calculation to give mock 3D effect based on ky
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.067 seconds with 15 queries.