Ive included full source because it aint all that big
// set window properties
SetWindowTitle( "Junior Pianist" )
SetWindowSize( 640, 480, 0 )
// set display properties
SetVirtualResolution( 640, 480 )
SetOrientationAllowed( 0, 0, 1, 1 )
#constant whitekey=1
#constant blackkey=2
#constant c=1
#constant d=2
#constant e=3
#constant f=4
#constant a=5
#constant b=6
#constant c1=7
#constant d1=8
#constant e1=9
#constant f1=10
#constant cs=11
#constant ds=12
#constant fs=13
#constant gs=14
#constant bb=15
#constant cs1=16
#constant ds1=17
#constant drum1=18
#constant drum2=19
#constant drum3=20
#constant drum4=21
#constant drum5=22
#constant piano=23
#constant organ=24
#constant sax=25
#constant guitar=26
#constant quit=27
loadImage (1,"whitekey.png")
LoadImage (2,"blackkey.png")
LoadImage (drum1,"drum1.png")
LoadImage (drum2,"drum2.png")
LoadImage (drum3,"drum3.png")
LoadImage (drum4,"drum4.png")
LoadImage (piano,"piano.png")
LoadImage (organ,"organ.png")
LoadImage (sax,"sax.png")
LoadImage (guitar,"guitar.png")
LoadImage (quit,"quit.png")
CreateSprite(c,whitekey)
CreateSprite(d,whitekey)
CreateSprite(e,whitekey)
CreateSprite(f,whitekey)
CreateSprite(a,whitekey)
CreateSprite(b,whitekey)
CreateSprite(c1,whitekey)
CreateSprite(d1,whitekey)
CreateSprite(e1,whitekey)
CreateSprite(f1,whitekey)
CreateSprite(cs,blackkey)
CreateSprite(ds,blackkey)
CreateSprite(fs,blackkey)
CreateSprite(gs,blackkey)
CreateSprite(bb,blackkey)
CreateSprite(cs1,blackkey)
CreateSprite(ds1,blackkey)
CreateSprite (drum1,drum1)
CreateSprite (drum2,drum2)
CreateSprite (drum3,drum3)
CreateSprite (drum4,drum4)
CreateSprite (piano,piano)
CreateSprite (organ,organ)
CreateSprite (sax,sax)
CreateSprite (guitar,guitar)
CreateSprite (quit,quit)
SetSpritePosition(c,1+15,130)
SetSpritePosition(d,62+15,130)
SetSpritePosition(e,123+15,130)
SetSpritePosition(f,184+15,130)
SetSpritePosition(a,245+15,130)
SetSpritePosition(b,306+15,130)
SetSpritePosition(c1,367+15,130)
SetSpritePosition(d1,428+15,130)
SetSpritePosition(e1,489+15,130)
SetSpritePosition(f1,550+15,130)
SetSpritePosition(cs,55,130)
SetSpritePosition(ds,115,130)
SetSpritePosition(fs,235,130)
SetSpritePosition(gs,295,130)
SetSpritePosition(bb,355,130)
SetSpritePosition(cs1,475,130)
SetSpritePosition(ds1,535,130)
SetSpritePosition (drum1,16,15)
SetSpritePosition (drum2,121,15)
SetSpritePosition (drum3,16,66)
SetSpritePosition (drum4,121,66)
SetSpritePosition (piano,240,15)
SetSpritePosition (organ,348,15)
SetSpritePosition (sax,240,66)
SetSpritePosition (guitar,348,66)
SetSpritePosition (quit,525,66)
LoadMusic (drum1,"drum1.wav")
LoadMusic (drum2,"drum2.wav")
LoadMusic (drum3,"drum3.wav")
LoadMusic (drum4,"drum4.wav")
LoadMusic (drum5,"drum5.wav")
loadInstrument("piano")
SetSpriteColorAlpha(piano,100)
//The Following variables are only used so as i can fade sprites etc
oldInstrument=piano
oldDrum=0
play=0
thenEnd=0
repeat
if ( GetPointerState ( ) = 1 )
spriteNum = GetSpriteHit ( GetPointerX ( ), GetPointerY ( ) )
SetSpriteColorAlpha(spriteNum,100)
if spriteNum=quit then thenEnd=1
if spriteNum <= ds1
PlaySound(spriteNum):play=1
else
if spriteNum > ds1 and spriteNum <=drum4
if oldDrum <> spriteNum then SetSpriteColorAlpha(oldDrum,255)
PlayMusic(spriteNum,1)
oldDrum=spriteNum
else
if oldInstrument <> spriteNum then SetSpriteColorAlpha(oldInstrument,255)
if spriteNum=piano then loadInstrument("piano")
if spriteNum=organ then loadInstrument("organ")
if spriteNum=sax then loadInstrument("saxophone")
if spriteNum=guitar then loadInstrument("guitar")
OldInstrument=spriteNum
endif
play=0
endif
endif
sync()
if play =1 then SetSpriteColorAlpha(spriteNum,255)
spriteNum=0
until thenEnd=1
end
function loadInstrument(instrument$ as string)
deleteInstruments()
SetFolder ("")
SetFolder("media")
SetFolder(instrument$)
LoadSound (c,"c.wav")
LoadSound (d,"d.wav")
LoadSound (e,"e.wav")
LoadSound (f,"f.wav")
LoadSound (a,"a.wav")
LoadSound (b,"b.wav")
LoadSound (c1,"c1.wav")
LoadSound (d1,"d1.wav")
LoadSound (e1,"e1.wav")
LoadSound (f1,"f1.wav")
LoadSound (cs,"cs.wav")
LoadSound (ds,"ds.wav")
LoadSound (fs,"fs.wav")
LoadSound (gs,"gs.wav")
LoadSound (bb,"bb.wav")
LoadSound (cs1,"cs1.wav")
LoadSound (ds1,"ds1.wav")
SetSoundInstanceVolume( c, 100 )
SetSoundInstanceVolume( d, 100 )
SetSoundInstanceVolume( e, 100 )
SetSoundInstanceVolume( f, 100 )
SetSoundInstanceVolume( a, 100 )
SetSoundInstanceVolume( b, 100 )
SetSoundInstanceVolume( c1, 100 )
SetSoundInstanceVolume( d1, 100 )
SetSoundInstanceVolume( e1, 100 )
SetSoundInstanceVolume( f1, 100 )
SetFolder ("")
SetFolder ("media")
endfunction
function deleteInstruments()
if GetSoundExists(c) then DeleteSound(c)
if GetSoundExists(d) then DeleteSound(d)
if GetSoundExists(e) then DeleteSound(e)
if GetSoundExists(f) then DeleteSound(f)
if GetSoundExists(a) then DeleteSound(a)
if GetSoundExists(b) then DeleteSound(b)
if GetSoundExists(c1) then DeleteSound(c1)
if GetSoundExists(d1) then DeleteSound(d1)
if GetSoundExists(e1) then DeleteSound(e1)
if GetSoundExists(f1) then DeleteSound(f1)
if GetSoundExists(cs) then DeleteSound(cs)
if GetSoundExists(ds) then DeleteSound(ds)
if GetSoundExists(fs) then DeleteSound(fs)
if GetSoundExists(gs) then DeleteSound(gs)
if GetSoundExists(bb) then DeleteSound(bb)
if GetSoundExists(cs1) then DeleteSound(cs1)
if GetSoundExists(ds1) then DeleteSound(ds1)
endfunction
The program fades out buttons when they are active and pressed
Everything seems to work fine under windows
when I try on my phone it locks up sometimes
At first I thought memory so I closed all the running apps in the background there was quite a few
the music keyboard works fine it even allows me to change the type of instrument
when I select the drums in particular it locks up or if I just go mad with the keys it freezes aswell.
At this stage I'm not sure if its my phone or something ive done drastically wrong
fubar