Ok Bee-Ant.
How do you do the shading on your art?
shadow_angle=light_angle+180;
(n-1) * (n/2) +n
n * floor(n/2) +n
int i;
int j;
int k;
for(i=0; i<300; i++){
CreateActor("puzzlepiece", "puz", "(none)", "(none)" , k*32, j*32, true);
j++;
if(j==20){
j=0;
k++;
}
}
int i;
int j;
int k;
for(i=0; i<300; i++){
j=i%20;
k=(i-j)/20;
CreateActor("puzzlepiece", "puz", "(none)", "(none)" , k*32, j*32, true);
}
int mapCells[300][2]; //this would go in global script
assigncells(32, 20); //32px cells, 20 in each row
void assigncells(int size, int hcells){
int i;
int j;
for(i=0; i<300; i++){
j=i%hcells; /*if i is 25, the remainder of i/20 is 5 that's the column, 25-5=20/20=1 that's the row....*/
k=(i-j)/hcells;
mapCells[i][0]=j*size; //storing x coordinate
mapCells[i][1]=k*size; //storing y coordinate
}
}
moveto("Event Actor", mapCells[mycell+1][0], mapCells[mycell+1][1], "", "", 4);
void Sort()
{
for(int i=0;i<999;i++)
{
for(int j=0;j<arraysize-1;j++)
{
int temp;
if(array[j+1]>array[j])
{
temp=array[j];
array[j]=array[j+1];
array[j+1]=temp;
}
}
}
}
DST wrote:then when you say, swap puzzle pieces, a piece has determined it must move into the cell to the right of it, then you just say
- Code: Select all
moveto("Event Actor", mapCells[mycell+1][0], mapCells[mycell+1][1], "", "", 4);
#define RIGHT mapCells[mycell+1][0]
#define LEFT mapCells[mycell-1][0]
moveto("Event Actor",RIGHT, RDOWN, "", "", 4);
moveto("Event Actor",RIGHT, RIGHTDOWN, "", "", 4);
moveto("Event Actor", mapCells[mycell+1][0], mapCells[mycell+1][0]mapCells[mycell+1][1], "", "", 4);
Bee-Ant wrote:Bubble sort using loops and array
- Code: Select all
void Sort()
{
for(int i=0;i<999;i++)
{
for(int j=0;j<arraysize-1;j++)
{
int temp;
if(array[j+1]>array[j])
{
temp=array[j];
array[j]=array[j+1];
array[j+1]=temp;
}
}
}
}
mx=0; //reset variable to 0
gx=xmouse; //store mouse coords
gy=ymouse;
mx=1; //indicate mouse was clicked
if(mx==1){ //if mouse has been pressed
if(abs(gx-x)<width/2 && abs(gy-y)<height/2){ //and mouse position is less than 1/2 width and height from actor center
//do mousebuttondownscripthere; //then i am the button that was clicked on.
mx-0; //click was recieved, so deactivate it. Force the variable back to 0.
}
}
DestroyActor("mxtest");
CreateActor("mxtest", "dot", "no_parent", "no_path", xmouse, ymouse, true);
//domousebuttondownstuffhere;
DestroyActor("Collide Actor");
Users browsing this forum: No registered users and 1 guest