sorry for not replying for some time, I've been other wise engaged.
this is the script that I am having issues with
function game()
setdisplayaspect (0.66)
setclearcolor (250,250,250)
//rem include files
#include "helppage.agc"
#include "home.agc"
#include "gameover.agc"
//rem laod images
brick = loadimage ("brick.png")
ball = loadimage ("ball.png")
pannel = loadimage ("pannel.png")
wall = loadimage ("wall.png")
reduce = loadimage ("reduce.png")
enlarge = loadimage ("enlarge.png")
smallpannel = loadimage ("smallpannel.png")
bigpannel = loadimage ("bigpannel.png")
triball = loadimage ("triball.png")
background = loadimage ("background.png")
pausebutton = loadimage ("pausebutton.png")
pause = loadimage ("pause.png")
play = loadimage ("playbutton.png")
help = loadimage ("helpbutton.png")
home = loadimage ("homebutton.png")
creditsbutton = loadimage ("creditsbutton.png")
credits = loadimage ("creditstext.png")
back = loadimage ("back.png")
//rem set create sprites
dim sprites[26] as integer
sprites[13] = createsprite (background)
sprites[2] = createsprite (ball)
sprites[3] = createsprite (pannel)
sprites[4] = createsprite (wall)
sprites[5] = createsprite (wall)
sprites[6] = createsprite (wall)
sprites[10] = createsprite (reduce)
sprites[11] = createsprite (enlarge)
sprites[12] = createsprite (triball)
sprites[14] = createsprite (pausebutton)
sprites[15] = createsprite (pause)
sprites[16] = createsprite (play)
sprites[17] = createsprite (help)
sprites[18] = createsprite (home)
sprites[19] = createsprite (creditsbutton)
sprites[20] = createsprite (credits)
sprites[21] = createsprite (back)
sprites[22] = createsprite (wall)
sprites[23] = createsprite (ball)
sprites[24] = createsprite (ball)
sprites[25] = createsprite (0)
sprites[26] = createsprite (back)
//rem set sprites size
setspritesize (sprites[2],6.2,4.1)
setspritesize (sprites[3],20,21)
setspritesize (sprites[4],1,100)
setspritesize (sprites[5],1,100)
setspritesize (sprites[6],100,1)
setspritesize (sprites[10],10,4)
setspritesize (sprites[11],10,4)
setspritesize (sprites[12],6,3)
setspritesize (sprites[13],100,100)
setspritesize (sprites[14],20,-1)
setspritesize (sprites[15],75,-1)
setspritesize (sprites[16],40,11)
setspritesize (sprites[17],40,11)
setspritesize (sprites[18],40,11)
setspritesize (sprites[19],40,11)
setspritesize (sprites[20],100,100)
setspritesize (sprites[21],20,-1)
setspritesize (sprites[22],100,1)
setspritesize (sprites[23],6.2,4.1)
setspritesize (sprites[24],6.2,4.1)
setspritesize (sprites[25],100,100)
setspritesize (sprites[26],20,-1)
//rem set sprite position
setspriteposition (sprites[2],45,75)
setspriteposition (sprites[3],50,82)
setspriteposition (sprites[4],0,0)
setspriteposition (sprites[5],99,0)
setspriteposition (sprites[6],0,99)
setspriteposition (sprites[10],1000,1000)
setspriteposition (sprites[11],1000,1000)
setspriteposition (sprites[12],1000,1000)
setspriteposition (sprites[14],75,4)
setspriteposition (sprites[15],1000,1000)
setspriteposition (sprites[16],1000,1000)
setspriteposition (sprites[17],1000,1000)
setspriteposition (sprites[18],1000,1000)
setspriteposition (sprites[19],1000,1000)
setspriteposition (sprites[20],1000,1000)
setspriteposition (sprites[21],1000,1000)
setspriteposition (sprites[22],0,0)
setspriteposition (sprites[23],1000,1000)
setspriteposition (sprites[24],1000,1000)
setspriteposition (sprites[25],1000,1000)
setspriteposition (sprites[26],1000,1000)
//rem set sprites physics on
setspritephysicson (sprites[2],2)
setspritephysicson (sprites[3],3)
setspritephysicson (sprites[4],3)
setspritephysicson (sprites[5],3)
setspritephysicson (sprites[6],3)
setspritephysicson (sprites[10],3)
setspritephysicson (sprites[11],3)
setspritephysicson (sprites[12],3)
setspritephysicson (sprites[22],3)
setspritephysicson (sprites[23],2)
setspritephysicson (sprites[24],2)
//rem make walls
setphysicswallbottom (1)
setphysicswalltop (1)
setphysicswallleft (1)
setphysicswallright (1)
setspritephysicsmass (sprites[2],0.5)
setspritephysicsmass (sprites[23],0.5)
setspritephysicsmass (sprites[24],0.5)
//set joystick position
setvirtualjoystickposition (1,82,90)
//rem set ball shape
setspriteshape (sprites[2],1)
setspriteshape (sprites[3],3)
setspriteshape (sprites[23],1)
setspriteshape (sprites[24],1)
// set sprite restitution
setspritephysicsrestitution (sprites[2],1.0)
setspritephysicsrestitution (sprites[23],1.0)
setspritephysicsrestitution (sprites[24],1.0)
//rem make more bricks
for i = 1 to 24
dim brick[i] as integer
brick[i] = createsprite (brick)
//rem set bricks shape
setspriteshape (brick[i],2)
//rem set bricks physics
setspritephysicson (brick[i],3)
//rem set bricks depth
setspritedepth (brick[i],1)
//rem set brick size
setspritesize (brick[i],10,4)
next i
//rem make animation
AddSpriteAnimationFrame ( sprites[25], LoadImage ( "picture1.png" ) )
AddSpriteAnimationFrame ( sprites[25], LoadImage ( "picture2.png" ) )
AddSpriteAnimationFrame ( sprites[25], LoadImage ( "picture3.png" ) )
AddSpriteAnimationFrame ( sprites[25], LoadImage ( "picture4.png" ) )
//rem set bricks positions
setspriteposition (brick[1],14,24)
setspriteposition (brick[2],26,24)
setspriteposition (brick[3],38,24)
setspriteposition (brick[4],50,24)
setspriteposition (brick[5],62,24)
setspriteposition (brick[6],74,24)
setspriteposition (brick[7],14,30)
setspriteposition (brick[8],26,30)
setspriteposition (brick[9],38,30)
setspriteposition (brick[10],50,30)
setspriteposition (brick[11],62,30)
setspriteposition (brick[12],74,30)
setspriteposition (brick[13],14,36)
setspriteposition (brick[14],26,36)
setspriteposition (brick[15],38,36)
setspriteposition (brick[16],50,36)
setspriteposition (brick[17],62,36)
setspriteposition (brick[18],74,36)
setspriteposition (brick[19],14,42)
setspriteposition (brick[20],26,42)
setspriteposition (brick[21],38,42)
setspriteposition (brick[22],50,42)
setspriteposition (brick[23],62,42)
setspriteposition (brick[24],74,42)
//rem to make a count of when sprites are hit
destroyed = 0
setphysicsgravity (0,2)
time = timer ()
level = 1
do
//rem ball hit pannel
if getphysicscollision (sprites[2],sprites[3]) = 1
setSpritePhysicsVelocity (sprites[2],(randomsign (1)*55),-60)
endif
for i = 23 to 24
//rem ball hit pannel
if getphysicscollision (sprites[i],sprites[3]) = 1
setSpritePhysicsVelocity (sprites[i],(randomsign (1)*55),-60)
endif
next i
//rem ball hit top of page
if getphysicscollision (sprites[2],sprites[22]) = 1
setSpritePhysicsVelocity (sprites[2],(randomsign (1)*20),45)
endif
for i = 23 to 24
//rem ball hit top of page
if getphysicscollision (sprites[i],sprites[22]) = 1
setSpritePhysicsVelocity (sprites[i],(randomsign (1)*20),45)
endif
next i
//rem print the score and lives
printc ("score=")
printc (score)
printc (" lives=" )
printc (lives )
setprintcolor(0,0,0,250)
//rem make joystick work
joystickx# = getvirtualjoystickx (1)
setspriteposition (sprites[3], getspritex (sprites[3]) + (joystickx# / 0.8),getspritey (sprites[3]) )
//rem give extra life if score hits a certain amount
if score = 140
lives = lives + 1
score = score + 10
elseif score = 290
lives = lives + 1
score = score + 10
elseif score = 350
lives = lives + 1
score = score + 10
elseif score = 560
lives = lives + 1
score = score + 10
elseif score = 710
lives = lives + 1
score = score + 10
elseif score = 830
lives = lives + 1
score = score + 10
elseif score = 1000
lives = lives + 1
score = score + 100
endif
//rem if pannel hits the left wall
if getspritecollision (sprites[3],sprites[4])
setspriteposition (sprites[3],0.1,82)
endif
//rem if pannel hits the right wall
x = getspritewidth (sprites[3]) + 0.1
if getspritecollision (sprites[3],sprites[5])
setspriteposition (sprites[3],(100-x),82)
endif
//rem if ball hits brick release reduce
if getphysicscollision (brick[3], sprites[2])
SetSpriteposition (sprites[10],getspritex(brick[3]),getspritey(brick[3]))
setSpritePhysicsVelocity (sprites[10],0,10)
endif
//rem if ball hits brick release enlarge
if getphysicscollision (brick[14], sprites[2])
SetSpriteposition (sprites[11],getspritex(brick[14]),getspritey(brick[14]))
setSpritePhysicsVelocity (sprites[11],0,10)
endif
//rem if ball hits brick release triball
if getphysicscollision (brick[22], sprites[2])
SetSpriteposition (sprites[12],getspritex(brick[22]),getspritey(brick[22]))
setSpritePhysicsVelocity (sprites[12],0,10)
endif
//rem make ball bounce off and destroy bricks when collide
for i = 1 to 24
if (getphysicscollision (brick[i], sprites[2]) = 1)
SetSpriteposition (brick[i],1000,1000)
score = score + 10
destroyed = destroyed + 1
endif
next i
//rem make player lose lives
if getphysicscollision (sprites[6], sprites[2])
lives = lives - 1
endif
//rem make player lose lives
for i = 23 to 24
if getphysicscollision (sprites[6], sprites[i])
lives = lives - 1
endif
next i
//rem game over when lives = o
if lives = 0
endscore = endscore + score
for i = 1 to 26
deletesprite (sprites[i])
next i
for i = 1 to 24
deletesprite (brick[i])
next i
setvirtualjoystickposition (1,1000,1000)
gameend()
endif
//rem if reduce hits pannel
if (getspritecollision (sprites[10], sprites[3]) = 1)
SetSpriteImage ( sprites[3], smallpannel )
setspriteposition(sprites[10],1000,1000)
setspritesize (sprites[3],20,21)
endif
//rem if enlage hits pannel
if (getspritecollision (sprites[11], sprites[3]) = 1)
SetSpriteImage ( sprites[3], bigpannel )
setspriteposition(sprites[11],1000,1000)
setspritesize (sprites[3],30,21)
endif
//rem if triball hits pannel
if (getspritecollision (sprites[12], sprites[3]) = 1)
setspriteposition(sprites[12],1000,1000)
setspriteposition (sprites[23],getspritex(sprites[2])+5,getspritey(sprites[2]))
setspriteposition (sprites[24],getspritex(sprites[2]),getspritey(sprites[2])+15)
setSpritePhysicsVelocity (sprites[23],(randomsign (1)*45),-45)
setSpritePhysicsVelocity (sprites[24],(randomsign (1)*45),-45)
endif
//rem if balls hit bonus
for i = 10 to 12
if getphysicscollision (sprites[i],sprites[2])
setspritephysicsvelocity (sprites[2],50,30)
endif
next i
for i = 10 to 12
for a = 23 to 24
if getphysicscollision (sprites[i],sprites[a])
setspritephysicsvelocity (sprites[2],50,30)
endif
next i
next a
//rem make ball2 bounce off and destroy bricks when collide
for i = 1 to 24
for a = 23 to 24
if (getphysicscollision (brick[i], sprites[a]) = 1)
SetSpriteposition (brick[i],1000,1000)
score = score + 10
destroyed = destroyed + 1
endif
next i
next a
// rem finish game when ball hits last brick
if destroyed = 24
level = level + 1
destroyed = 0
endif
//rem level 2
if level = 2
//rem set bricks positions
setspriteposition (brick[1],45,8)
setspriteposition (brick[2],33,14)
setspriteposition (brick[3],45,14)
setspriteposition (brick[4],57,14)
setspriteposition (brick[5],26,20)
setspriteposition (brick[6],38,20)
setspriteposition (brick[7],52,20)
setspriteposition (brick[8],64,20)
setspriteposition (brick[9],26,26)
setspriteposition (brick[10],38,26)
setspriteposition (brick[11],52,26)
setspriteposition (brick[12],64,26)
setspriteposition (brick[13],33,32)
setspriteposition (brick[14],45,32)
setspriteposition (brick[15],57,32)
setspriteposition (brick[16],45,38)
setspriteposition (brick[17],8.3,44)
setspriteposition (brick[18],26.6,44)
setspriteposition (brick[19],44.9,44)
setspriteposition (brick[20],63.2,44)
setspriteposition (brick[21],81.5,44)
setspriteposition (brick[22],17.5,50)
setspriteposition (brick[23],45,50)
setspriteposition (brick[24],72.5,50)
setspriteposition (sprites[2],45,75)
setspriteposition (sprites[23],1000,1000)
setspriteposition (sprites[24],1000,1000)
endif
//rem if get pause hit
if GetPointerState()
x# = GetPointerX()
y# = GetPointerY()
if GetSpriteHit(x#, y#) = sprites[15]
endif
endif
if GetPointerReleased()
x# = GetPointerX()
y# = GetPointerY()
if GetSpriteHit(x#, y#) = sprites[14]
setspritephysicsoff (sprites[2])
setspritephysicsoff (sprites[23])
setspritephysicsoff (sprites[24])
setspriteposition (sprites[20],1000,1000)
setspriteposition (sprites[15],12.5,10)
setspriteposition (sprites[16],30,17)
setspriteposition (sprites[17],30,31)
setspriteposition (sprites[18],30,45)
setspriteposition (sprites[19],30,59)
for i = 15 to 19
setspritedepth (sprites[i],0)
next i
endif
endif
//rem if get play hit
if GetPointerState()
x# = GetPointerX()
y# = GetPointerY()
if GetSpriteHit(x#, y#) = sprites[16]
endif
endif
if GetPointerReleased()
x# = GetPointerX()
y# = GetPointerY()
if GetSpriteHit(x#, y#) = sprites[16]
for i = 23 to 24
setspritephysicson(sprites[2],2)
setspritephysicson (sprites[i],2)
setspritephysicsvelocity (sprites[2],50,50)
setspritephysicsvelocity (sprites[i],50,50)
setspriteposition (sprites[15],1000,1000)
setspriteposition (sprites[16],1000,1000)
setspriteposition (sprites[17],1000,1000)
setspriteposition (sprites[18],1000,1000)
setspriteposition (sprites[19],1000,1000)
setspriteposition (sprites[20],1000,1000)
setspriteposition (sprites[21],1000,1000)
next i
endif
endif
//rem if get credits hit
if GetPointerState()
x# = GetPointerX()
y# = GetPointerY()
if GetSpriteHit(x#, y#) = sprites[19]
endif
endif
if GetPointerReleased()
x# = GetPointerX()
y# = GetPointerY()
if GetSpriteHit(x#, y#) = sprites[19]
setspriteposition (sprites[20],0,0)
setspriteposition (sprites[21],5,90)
setspritedepth (sprites[20],1)
setspritedepth (sprites[21],1)
endif
endif
//rem if get back hit
if GetPointerState()
x# = GetPointerX()
y# = GetPointerY()
if GetSpriteHit(x#, y#) = sprites[21]
endif
endif
if GetPointerReleased()
x# = GetPointerX()
y# = GetPointerY()
if GetSpriteHit(x#, y#) = sprites[21]
setspriteposition (sprites[20],1000,1000)
setspriteposition (sprites[21],1000,1000)
setspriteposition (sprites[15],12.5,10)
setspriteposition (sprites[16],30,17)
setspriteposition (sprites[17],30,31)
setspriteposition (sprites[18],30,45)
setspriteposition (sprites[19],30,59)
endif
endif
//rem if get home hit
if GetPointerState()
x# = GetPointerX()
y# = GetPointerY()
if GetSpriteHit(x#, y#) = sprites[18]
endif
endif
if GetPointerReleased()
x# = GetPointerX()
y# = GetPointerY()
if GetSpriteHit(x#, y#) = sprites[18]
setspriteposition (sprites[2],1000,1000)
setspriteposition (sprites[3],1000,1000)
setspriteposition (sprites[4],1000,1000)
setspriteposition (sprites[5],1000,1000)
setspriteposition (sprites[6],1000,1000)
setspriteposition (sprites[10],1000,1000)
setspriteposition (sprites[11],1000,1000)
setspriteposition (sprites[12],1000,1000)
setspriteposition (sprites[14],1000,1000)
setspriteposition (sprites[15],1000,1000)
setspriteposition (sprites[16],1000,1000)
setspriteposition (sprites[17],1000,1000)
setspriteposition (sprites[18],1000,1000)
setspriteposition (sprites[19],1000,1000)
setspriteposition (sprites[20],1000,1000)
setspriteposition (sprites[21],1000,1000)
for i = 1 to 24
setspriteposition (brick[i],1000,1000)
next i
setvirtualjoystickposition (1,1000,1000)
if time => 2
homepage()
endif
endif
endif
//rem if get help hit
if GetPointerState()
x# = GetPointerX()
y# = GetPointerY()
if GetSpriteHit(x#, y#) = sprites[17]
endif
endif
if GetPointerReleased()
x# = GetPointerX()
y# = GetPointerY()
if GetSpriteHit(x#, y#) = sprites[17]
setspriteposition (sprites[23],1000,1000)
setspriteposition (sprites[24],1000,1000)
setspriteposition (sprites[25],0,0)
PlaySprite ( sprites[25], 0.12, 1, 1, 4 )
setspritedepth (sprites[18],0)
setspritedepth (sprites[25],0)
setspritedepth (sprites[26],0)
setspriteposition (sprites[18],50,83)
setspriteposition (sprites[26],13,88)
setvirtualjoystickposition (1,1000,1000)
endif
endif
//rem if get back from help hit
if GetPointerState()
x# = GetPointerX()
y# = GetPointerY()
if GetSpriteHit(x#, y#) = sprites[26]
endif
endif
if GetPointerReleased()
x# = GetPointerX()
y# = GetPointerY()
if GetSpriteHit(x#, y#) = sprites[26]
setspriteposition (sprites[25],1000,1000)
setspriteposition (sprites[26],1000,1000)
setvirtualjoystickposition (1,85,85)
setspriteposition (sprites[18],30,45)
endif
endif
Sync()
loop
endfunction
this is the section of the code that is not working
setspriteposition (brick[24],72.5,50)
setspriteposition (sprites[2],45,75)
setspriteposition (sprites[23],1000,1000)
setspriteposition (sprites[24],1000,1000)
endif
thanks
kirtnicholls