This may be a daft question, but when I try to run my program the sprites start flashing during the loop phase.
It doesnt happen to all the sprites on the screen, only the same selected ones every time. I have attached the code, although it is abitty long.
Any suggestions how to overcome this.
Rem Set variables
t1=0:t2=0:t3=0:t4=0:pl=0:xt=3:x=256:x#=256
time=timer()
randomize (time)
hide mouse
rem Create Arrays
dim hi(10,1)
dim hi$(10,1)
Dim sq(98,2)
rem load arrays
load array "hi1",hi(0)
load array "hi2",hi$(0)
rem set array values
sq(1,1)=95:sq(1,2)=440
sq(2,1)=158:sq(2,2)=440
sq(3,1)=221:sq(3,2)=440
sq(4,1)=284:sq(4,2)=440
sq(5,1)=347:sq(5,2)=440
sq(6,1)=410:sq(6,2)=440
sq(7,1)=473:sq(7,2)=440
sq(8,1)=536:sq(8,2)=440
sq(9,1)=599:sq(9,2)=440
sq(10,1)=599:sq(10,2)=393
sq(11,1)=536:sq(11,2)=393
sq(12,1)=473:sq(12,2)=393
sq(13,1)=410:sq(13,2)=393
sq(14,1)=347:sq(14,2)=393
sq(15,1)=284:sq(15,2)=393
sq(16,1)=221:sq(16,2)=393
sq(17,1)=158:sq(17,2)=393
sq(18,1)=95:sq(18,2)=393
sq(19,1)=32:sq(19,2)=393
sq(20,1)=32:sq(20,2)=346
sq(21,1)=95:sq(21,2)=346
sq(22,1)=158:sq(22,2)=346
sq(23,1)=221:sq(23,2)=346
sq(24,1)=284:sq(24,2)=346
sq(25,1)=347:sq(25,2)=346
sq(26,1)=410:sq(26,2)=346
sq(27,1)=473:sq(27,2)=346
sq(28,1)=536:sq(28,2)=346
sq(29,1)=599:sq(29,2)=346
sq(30,1)=599:sq(30,2)=299
sq(31,1)=536:sq(31,2)=299
sq(32,1)=473:sq(32,2)=299
sq(33,1)=410:sq(33,2)=299
sq(34,1)=347:sq(34,2)=299
sq(35,1)=284:sq(35,2)=299
sq(36,1)=221:sq(36,2)=299
sq(37,1)=158:sq(37,2)=299
sq(38,1)=95:sq(38,2)=299
sq(39,1)=32:sq(39,2)=299
sq(40,1)=32:sq(40,2)=252
sq(41,1)=95:sq(41,2)=252
sq(42,1)=158:sq(42,2)=252
sq(43,1)=221:sq(43,2)=252
sq(44,1)=284:sq(44,2)=252
sq(45,1)=347:sq(45,2)=252
sq(46,1)=410:sq(46,2)=252
sq(47,1)=473:sq(47,2)=252
sq(48,1)=536:sq(48,2)=252
sq(49,1)=599:sq(49,2)=252
sq(50,1)=599:sq(50,2)=205
sq(51,1)=536:sq(51,2)=205
sq(52,1)=473:sq(52,2)=205
sq(53,1)=410:sq(53,2)=205
sq(54,1)=347:sq(54,2)=205
sq(55,1)=284:sq(55,2)=205
sq(56,1)=221:sq(56,2)=205
sq(57,1)=158:sq(57,2)=205
sq(58,1)=95:sq(58,2)=205
sq(59,1)=32:sq(59,2)=205
sq(60,1)=32:sq(60,2)=158
sq(61,1)=95:sq(61,2)=158
sq(62,1)=158:sq(62,2)=158
sq(63,1)=221:sq(63,2)=158
sq(64,1)=284:sq(64,2)=158
sq(65,1)=347:sq(65,2)=158
sq(66,1)=410:sq(66,2)=158
sq(67,1)=473:sq(67,2)=158
sq(68,1)=536:sq(68,2)=158
sq(69,1)=599:sq(69,2)=158
sq(70,1)=599:sq(70,2)=111
sq(71,1)=536:sq(71,2)=111
sq(72,1)=473:sq(72,2)=111
sq(73,1)=410:sq(73,2)=111
sq(74,1)=347:sq(74,2)=111
sq(75,1)=284:sq(75,2)=111
sq(76,1)=221:sq(76,2)=111
sq(77,1)=158:sq(77,2)=111
sq(78,1)=95:sq(78,2)=111
sq(79,1)=32:sq(79,2)=111
sq(80,1)=32:sq(80,2)=64
sq(81,1)=95:sq(81,2)=64
sq(82,1)=158:sq(82,2)=64
sq(83,1)=221:sq(83,2)=64
sq(84,1)=284:sq(84,2)=64
sq(85,1)=347:sq(85,2)=64
sq(86,1)=410:sq(86,2)=64
sq(87,1)=473:sq(87,2)=64
sq(88,1)=536:sq(88,2)=64
sq(89,1)=599:sq(89,2)=64
sq(90,1)=599:sq(90,2)=17
sq(91,1)=536:sq(91,2)=17
sq(92,1)=473:sq(92,2)=17
sq(93,1)=410:sq(93,2)=17
sq(94,1)=347:sq(94,2)=17
sq(95,1)=284:sq(95,2)=17
sq(96,1)=221:sq(96,2)=17
sq(97,1)=158:sq(97,2)=17
sq(98,1)=95:sq(98,2)=17
rem start screen
gosub setdisplay:
gosub settext2:
gosub loadimages:
gosub loadmusic:
gosub loadbitmaps
gosub loadimages:
gosub formsprites:
gosub settext:
gosub playanim:
hide mouse
Repeat
xm = mousex()+7
yn = mousey()+7
sprite 6,xm,yn,6
if mouseclick()=1
if xm > 342 and xm 250 and yn280 and yn310 and yn340 and yn0
rem create player arrays
xb=pl
dim pl(xb,8)
dim pl$(xb,2)
gosub deletespriteanim:
gosub players:
gosub drawsnakes:
gosub drawdice:
gosub drawback:
gosub playernam:
dicesetup:
dice=rnd(5)+11
Sprite 8,680,400,dice
dicen=0
return
sync rate 30
goto mg:
settext2:
set text size 12
center text 400,170,"Created by B Robertson"
center text 400,190,"Latest Version 0.01.03 - dated 9th Jan 2003"
return
setdisplay:
set display mode 800,600,32
return
loadmusic:
load music "ebr.mid",1
play music 1
return
loadbitmaps:
load bitmap "snaketext.bmp",1
set current bitmap 1
get image 1,1,1,288,37
return
loadimages:
load image "pl1.bmp",2
load image "pl2.bmp",3
Load image "pl3.bmp",4
load image "pl4.bmp",5
load image "cross.bmp",6
load image "counter1.bmp",17
Load image "counter2.bmp",18
load image "counter3.bmp",19
load image "counter4.bmp",20
load animation "snake.avi",1
load animation "snake.avi",2
load image "button1.bmp",21
load image "snake1.bmp",22
load image "snake1.bmp",23
load image "snake2.bmp",24
load image "ladder1.bmp",25
load image "ladder2.bmp",26
load image "ladder3.bmp",27
load image "dice1.bmp",11
load image "dice2.bmp",12
load image "dice3.bmp",13
load image "dice4.bmp",14
load image "dice5.bmp",15
load image "dice6.bmp",16
return
formsprites:
sprite 1,256,100,1
sprite 2,342,250,2
sprite 3,342,280,3
sprite 4,342,310,4
sprite 5,342,340,5
sprite 6,400,400,6
delete bitmap 1
return
settext:
ink rgb(244,214,210),0
set text font "verdanda"
set text size 30
return
playanim:
play animation 1,100,100
play animation 2,600,100
loop animation 1
loop animation 2
return
deletespriteanim:
delete sprite 2
delete sprite 3
delete sprite 4
delete sprite 5
delete animation 1
delete animation 2
return
players:
For n=1 to pl
cls
set text size 12
center text 400,170,"Created by B Robertson"
center text 400,190,"Latest Version 0.01.03 - dated 9th Jan 2003"
xn = mousex()+7
yn = mousey()+7
sprite 6,xn,yn,6
cnt=0
b=n+1
pot$=str$(n)
set cursor 320,300
set text size 25
center text 400,280,"Player "
center text 460,280,pot$
xn = mousex()+7
yn = mousey()+7
sprite 6,xn,yn,6
input "Enter Name: ";name$
repeat
center text 400,345,"Click on one of the following counters"
if t1=0 then sprite 2,150,400,17
if t2=0 then sprite 3,300,400,18
if t3=0 then sprite 4,450,400,19
if t4=0 then sprite 5,600,400,20
xn = mousex()+7
yn = mousey()+7
sprite 6,xn,yn,6
if mouseclick()=1
if yn > 400 and yn 150 and xn300 and xn450 and xn600 and xn0
pl$(n,1)=name$
pl$(n,2)=counter$
pl(n,2)=plc
delete sprite cnt
next n
return
Drawsnakes:
cls
sprite 1,35,200,22
sprite 2,500,100,23
sprite 3,300,300,24
sprite 4,130,350,25
sprite 5,450,60,25
sprite 6,200,30,26
sprite 7,150,20,27
dice=rnd(5)+11
return
drawdice:
Sprite 8,680,400,dice
return
plcounters:
drawback:
ink rgb(244,214,210),0
for n=1 to 97 step 2
a=sq(n,1):b=sq(n,2)
box (a-31),(b-16),(a+32),(b+31)
next n
sync off
ink rgb(0,200,0),0
for n = 1 to 631 step 63
Line n,1,n,470
next n
for y= 1 to 471 step 47
line 1,y,630,y
next y
ink rgb(244,214,210),0
set text font "verdana"
set text size 20
for n=2 to 98 step 2
s=n
c$=str$(s)
q=sq(n,1):r=sq(n,2)
center text q,r,c$
next n
center text 32,440,"START"
center text 32,17,"FINISH"
ink rgb(0,0,0),0
for n=1 to 97 step 2
s=n
c$=str$(s)
q=sq(n,1):r=sq(n,2)
center text q,r,c$
next n
return
playernam:
set text size 12
ink rgb(244,214,210),0
for f=1 to pl
b=(f*15)+480
f$=pl$(f,1)
text 1,b, "Player : "
text 50,b, f$
next f
return
mg:
playerup=1
ink rgb(0,0,0),0
for n=1 to pl
create bitmap 1,640,480
paste image 21,0,0
a$=pl$(n,1)
b$=" you are up !"
text$=a$+b$
set text size 20
center text 75,13, text$
get image n+27,0,0,150,37
delete bitmap 1
set current bitmap 0
sprite n+8,300,515,n+27
pl(n,7)=n+8
pl(n,8)=n+27
next n
Do
dicen=0
gosub displaycounters:
gosub loadimages2:
gosub createplayerupscr:
gosub diceroll:
gosub dicecalc:
gosub dicestart2:
loop
displaycounters:
for n=1 to pl
if pl(n,1)>0 then sq2=pl(n,1):x=sq(sq2,1):y=(sq(sq2,2)-5)+(n*5):img=pl(n,2):sprite n+10,x,y,img else gosub displaystartfinish:
next n
return
displaystartfinish:
if pl(n,1)= 0 then sprite n+10,32,435+(n*5),pl(n,2)
if pl(n,1)=100 then sprite n+10,32,12+(n*5),pl(n,2)
return
loadimages2:
load image "cross.bmp",22
return
createplayerupscr:
sprite pl(playerup,7),300,515,pl(playerup,8)
return
diceroll:
repeat
xm = mousex()+7
yn = mousey()+7
sprite 10,xm,yn,22
if mouseclick()=1
if xm > 680 and xm 400 and ynpl then playerup=1
sync rate 30
sync on
sync
sync off
return
input "";a$