home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fun Online 1997 April
/
FOL0497.iso
/
win95
/
tvml.z
/
grid.$$$
< prev
next >
Wrap
Text File
|
1996-02-03
|
11KB
|
686 lines
sub read_sprite_tile_game()
spritebank 11
transparentcolour 0,89,155,78
SPRITEFILE gif,server+country+`/`+current_n
DEFSPRITE 0, 41, 31,230,230
DEFSPRITE 1, 271, 31,230,230
DEFSPRITE 2, 501, 31,230,230
DEFSPRITE 3, 731, 31,230,230
DEFSPRITE 4, 41, 261,230,230
DEFSPRITE 5, 271, 261,230,230
DEFSPRITE 6, 501, 261,230,230
DEFSPRITE 7, 731, 261,230,230
DEFSPRITE 8, 41, 491,230,230
DEFSPRITE 9, 271, 491,230,230
DEFSPRITE 10, 501, 491,230,230
DEFSPRITE 11, 731, 491,230,230
spritebank 10
SPRITEFILE gif,server_games+`mask.bmp`
DEFSPRITE 0, 0, 0,242,242
spritebank 0
end sub
sub display_sprite_tile_game()
local
int row,col
end local
// activepage 1
// loadimage 1100,160,170,170,gif,server+country+`/`+current_n
// activepage 0
// clearscreen 1100,160,170,170,standard,1,255
cut_sprite_tile_game=0
pencolour 0,0,0,0
forc(row=166;row<892;row+=242)
{
forc(col=116;col<1084;col+=242)
{
pos_x_tile_game[cut_sprite_tile_game]=col
pos_y_tile_game[cut_sprite_tile_game]=row
SPRITEb cut_sprite_tile_game+100,col-6,row-6,LOOPED,1,100,10,[0]
SpriteFlags2 cut_sprite_tile_game+100, enabled|visible, UNBOUND
SPRITEb cut_sprite_tile_game,col,row,looped,1,100,11,[cut_sprite_tile_game]
SpriteFlags2 cut_sprite_tile_game, visible|enabled, UNBOUND
// SpriteFlags2 cut_sprite_tile_game, clickable|visible|enabled, UNBOUND
grid[cut_sprite_tile_game]=cut_sprite_tile_game
cut_sprite_tile_game++
}
}
grid[0]=0
last_grid=0
movespriteto 0,5000,500
movespriteto 100,5000,5000
end sub
sub move_accross_left_tile_game(start_x as int,y_pos as int,sprite_no as int)
local
int end_x
end local
end_x=start_x-242
ifc(random_is_on==0)
sound server_games+`move.wav wave`
forc(count_tile_game=start_x;count_tile_game>end_x;count_tile_game-=20)
{
movespriteto sprite_no+100,count_tile_game-6,y_pos-6
movespriteto sprite_no,count_tile_game,y_pos
wait tile_speed
}
movespriteto sprite_no,end_x,y_pos
movespriteto sprite_no+100,end_x-6,y_pos-6
move=2
end sub
sub move_accross_right_tile_game(start_x as int ,y_pos as int ,sprite_no as int)
local
int end_x
end local
end_x=start_x+242
ifc(random_is_on==0)
sound server_games+`move.wav wave`
forc(count_tile_game=start_x;count_tile_game<end_x;count_tile_game+=20)
{
movespriteto sprite_no+100,count_tile_game-6,y_pos-6
movespriteto sprite_no,count_tile_game,y_pos
wait tile_speed
}
movespriteto sprite_no+100,end_x-6,y_pos-6
movespriteto sprite_no,end_x,y_pos
move=2
end sub
sub move_up_tile_game(x_pos as int ,start_y as int ,sprite_no as int)
local
int end_y
end local
end_y=start_y-242
ifc(random_is_on==0)
sound server_games+`move.wav wave`
forc(count_tile_game=start_y;count_tile_game>end_y;count_tile_game-=20)
{
movespriteto sprite_no+100,x_pos-6,count_tile_game-6
movespriteto sprite_no,x_pos,count_tile_game
wait tile_speed
}
movespriteto sprite_no+100,x_pos-6,end_y-6
movespriteto sprite_no,x_pos,end_y
move=2
end sub
sub move_down_tile_game(x_pos as int ,start_y as int ,sprite_no as int)
local
int end_y
end local
end_y=start_y+242
ifc(random_is_on==0)
sound server_games+`move.wav wave`
forc(count_tile_game=start_y;count_tile_game<end_y;count_tile_game+=24)
{
movespriteto sprite_no+100,x_pos-6,count_tile_game-6
movespriteto sprite_no,x_pos,count_tile_game
wait tile_speed
}
movespriteto sprite_no+100,x_pos-6,end_y-6
movespriteto sprite_no,x_pos,end_y
move=2
end sub
sub check_last_tile_game(new_sel as int)
ifc(per_last_grid=chosen)
chosen=new_sel
end sub
sub random_move_tile_game()
local
int use_sprite
end local
random_is_on=1
gettime hr,m,s,c
randomise(s)
ran_no=random()
per_last_grid=0
forc(total_moves=1;total_moves<random_moves;total_moves++)
{
ifc(last_grid==0)
{
ran_no=random()
ifc(int(ran_no*10)>5)
{
chosen=1
check_last_tile_game(4)
}
else
{
chosen=4
check_last_tile_game(1)
}
}
ifc(last_grid==1)
{
ran_no=random()
ifc(int(ran_no*10)<3)
{
chosen=0
check_last_tile_game(5)
}
else
{
ifc(int(ran_no*10)<6)
{
chosen=5
check_last_tile_game(2)
}
else
{
chosen=2
check_last_tile_game(0)
}
}
}
ifc(last_grid==2)
{
ran_no=random()
ifc(int(ran_no*10)<3)
{
chosen=1
check_last_tile_game(6)
}
else
{
ifc(int(ran_no*10)<6)
{
chosen=6
check_last_tile_game(3)
}
else
{
chosen=3
check_last_tile_game(1)
}
}
}
ifc(last_grid==3)
{
ran_no=random()
ifc(int(ran_no*10)<5)
{
chosen=2
check_last_tile_game(7)
}
else
{
chosen=7
check_last_tile_game(2)
}
}
ifc(last_grid==4)
{
ran_no=random()
ifc(int(ran_no*10)<3)
{
chosen=5
check_last_tile_game(8)
}
else
{
ifc(int(ran_no*10)<6)
{
chosen=8
check_last_tile_game(0)
}
else
{
chosen=0
check_last_tile_game(5)
}
}
}
ifc(last_grid==5)
{
ran_no=random()
ifc(ran_no*10<2.5)
{
chosen=1
check_last_tile_game(6)
}
else
{
ifc(ran_no*10<5.0)
{
chosen=6
check_last_tile_game(9)
}
else
{
ifc(ran_no*10<7.5)
{
chosen=9
check_last_tile_game(4)
}
else
{
chosen=4
check_last_tile_game(1)
}
}
}
}
ifc(last_grid==6)
{
ran_no=random()
ifc(ran_no*10<2.5)
{
chosen=2
check_last_tile_game(7)
}
else
{
ifc(ran_no*10<5.0)
{
chosen=7
check_last_tile_game(10)
}
else
{
ifc(ran_no*10<7.5)
{
chosen=10
check_last_tile_game(5)
}
else
{
chosen=5
check_last_tile_game(2)
}
}
}
}
ifc(last_grid==7)
{
ran_no=random()
ifc(int(ran_no*10)<3)
{
chosen=3
check_last_tile_game(6)
}
else
{
ifc(int(ran_no*10)<6)
{
chosen=6
check_last_tile_game(11)
}
else
{
chosen=11
check_last_tile_game(3)
}
}
}
ifc(last_grid==8)
{
ran_no=random()
ifc(int(ran_no*10)<5)
{
chosen=4
check_last_tile_game(9)
}
else
{
chosen=9
check_last_tile_game(4)
}
}
ifc(last_grid==9)
{
ran_no=random()
ifc(int(ran_no*10)<3)
{
chosen=8
check_last_tile_game(5)
}
else
{
ifc(int(ran_no*10)<6)
{
chosen=5
check_last_tile_game(10)
}
else
{
chosen=10
check_last_tile_game(8)
}
}
}
ifc(last_grid==10)
{
ran_no=random()
ifc(int(ran_no*10)<3)
{
chosen=11
check_last_tile_game(6)
}
else
{
ifc(int(ran_no*10)<6)
{
chosen=6
check_last_tile_game(9)
}
else
{
chosen=9
check_last_tile_game(11)
}
}
}
ifc(last_grid==11)
{
ran_no=random()
ifc(int(ran_no*10)<5)
{
chosen=10
check_last_tile_game(7)
}
else
{
chosen=7
check_last_tile_game(10)
}
}
x=pos_x_tile_game[chosen]
y=pos_y_tile_game[chosen]
per_last_grid=last_grid
ifc(blank_x==x-242 && blank_y==y)
{
move_accross_left_tile_game(x,blank_y,grid[chosen])
blank_x=x
grid[last_grid]=grid[last_grid+1]
grid[last_grid+1]=0
last_grid++
grid[last_grid]=0
}
ifc(blank_x==x+242 && blank_y==y)
{
move_accross_right_tile_game(x,blank_y,grid[chosen])
blank_x=x
grid[last_grid]=grid[last_grid-1]
last_grid--
grid[last_grid]=0
}
ifc(blank_x==x && blank_y==y-242)
{
move_up_tile_game(blank_x,y,grid[chosen])
blank_y=y
grid[last_grid]=grid[last_grid+4]
grid[last_grid+4]=0
last_grid+=4
grid[last_grid]=0
}
ifc(blank_x==x && blank_y==y+242)
{
move=1
move_down_tile_game(blank_x,y,grid[chosen])
blank_y=y
grid[last_grid]=grid[last_grid-4]
grid[last_grid-4]=0
last_grid-=4
grid[last_grid]=0
}
}
random_is_on=0
forc(use_sprite=0;use_sprite<cut_sprite_tile_game;use_sprite++)
{
SpriteFlags2 use_sprite, clickable|visible|enabled, UNBOUND
}
end sub
sub check_done_tile_game()
local
int check_pos
end local
ts=1
forc(check_pos=1;check_pos<12;check_pos++)
{
ifc(check_pos==grid[check_pos])
ts++
}
end sub
sub start_to_use_tile_game()
on_sprite_drop id,x,y,
{
print " blank x ",blank_x,"\n"
print " blank y ",blank_y,"\n"
ifc(move==0)
{
ifc(blank_x==x-242 && blank_y==y)
{
move=1
move_accross_left_tile_game(x,blank_y,id)
blank_x=x
grid[last_grid]=id
last_grid++
}
}
ifc(move==0)
{
ifc(blank_x==x+242 && blank_y==y)
{
move=1
move_accross_right_tile_game(x,blank_y,id)
blank_x=x
grid[last_grid]=id
last_grid--
}
}
ifc(move==0)
{
ifc(blank_x==x && blank_y==y-242)
{
move=1
move_up_tile_game(blank_x,y,id)
blank_y=y
grid[last_grid]=id
last_grid+=4
}
}
ifc(move==0)
{
ifc(blank_x==x && blank_y==y+242)
{
move=1
move_down_tile_game(blank_x,y,id)
blank_y=y
grid[last_grid]=id
last_grid-=4
}
}
id1=98
settext id1, itostr(last_grid)
ifc(move==2)
{
move=0
check_done_tile_game()
ifc(ts==12)
{
sound server_games+`done.wav wave`
// activepage 1
// loadimage 110,160,968,726,gif,server+country+`/`+current_n
// activepage 0
// clearscreen 0,0,1280,960,standard,1,255
wait 3000
forc(cut_sprite_tile_game=0;cut_sprite_tile_game<12;cut_sprite_tile_game++)
{
delsprite cut_sprite_tile_game+100
delsprite cut_sprite_tile_game
}
// start_to_use_tile_game()
}
}
}
end sub
sub tile_game(start_sprite as int)
on_sprite_drop id,x,y,
{
null
}
total_moves=0
blank_x=116
blank_y=166
dg_no_tile_game=start_sprite
current_n=filename(itostr(dg_no_tile_game))+`l`+load_ext4
// activepage 1
// loadimage 110,160,968,726,gif,server+country+`/`+current_n
// activepage 0
// clearscreen 0,0,1280,960,standard,1,255
move=0
read_sprite_tile_game()
display_sprite_tile_game()
wait 2000
ifc(exit_tile==0)
{
FILLMASK1 255,255,255
pencolour 0,255,255,255
activepage 1
rectangle 110,160,968,726
activepage 0
clearscreen 110,160,968,726,standard,1,255
}
ifc(total_moves!=random_moves)
{
random_move_tile_game()
start_to_use_tile_game()
}
end sub