Yo,
Looks like I got another bit of a problem with UV scrolling that hopefully someone can help me with.
I was able to implement it to my belief with no errors. It works just fine on windows however when on android the UV scrolling likes to split up the image im using and creates a large invisible line between the scrolling image. I have attached a image for viewing what I mean.
In the order used:
here is the code i used to set up the UV setting for the image in question:
//this function load all the needed images, sounds, music and extra into the game for efficentcy
function loadmedia()
//***************images*************
loadimage (BG1image, "sky.png") //load the 1st background image
setImageWrapU( BG1image , 1 )
setImageWrapV( BG1image , 1 )
BGimageW# = getImageWidth( BG1image )
BGimageH# = getImageHeight( BG1image )
screenWidth# = 800.0
screenHeight# = 480.0
// Determine Scale of Texture to make image 1:1
BGUscale# = BGimageW# / screenWidth#
BGVscale# = BGimageH# / screenHeight#
`loadimage (BG2image, "BG2.png") //load the 2nd background image
loadimage(pointimage, "point.png") // load the image for the point of touch sprite
loadimage(pauseimage, "pausen.png") //load the image for the in game pasue icon
loadimage(pausemimage, "pause.png") //load the image for the pasue menu
loadimage(resumimage, "resume.png") //load the image for the resmue pasue icon
loadimage(qiimage, "iquit.png") //load the image for the quit pasue icon
loadimage(musicimage, "musicb.png") //load the image for the music icon
loadimage(soundimage, "soundb.png") //load the image for the sound icon
loadimage(partimage, "shine.png") //load the particle image
loadimage(transimage, "trans.png") //load image the will be used for the transition phase animation
`loadimage(BG3image, "block.png") //load the image that conceals the clear color
loadimage(sideimage, "border1.png") //load the image for the side bar cloud wall effect
setImageWrapU( sideimage , 1 )
setImageWrapV( sideimage , 1 )
sideimageW# = getImageWidth( sideimage )
sideimageH# = getImageHeight( sideimage )
// Determine Scale of Texture to make image 1:1
sideUscale# = sideimageW# / screenWidth#
sideVscale# = sideimageH# / screenHeight#
loadimage(side2image, "border2.png")
setImageWrapU( side2image , 1 )
setImageWrapV( side2image , 1 )
side2imageW# = getImageWidth( side2image )
side2imageH# = getImageHeight( side2image )
// Determine Scale of Texture to make image 1:1
side2Uscale# = side2imageW# / screenWidth#
side2Vscale# = side2imageH# / screenHeight#
loadimage(flyerimage, "bird.png") //load the image for the side bar cloud wall effect
loadimage(enemyimage, "enemy2.png") //load image for the main enemy array
loadimage(barimage, "bar.png") //load the image for the meter bar sprites array
//********sounds*******************
loadsound (collectsound, "collect.wav") //load the collect sound
loadsound (explodesound, "explode.wav") //load the death sound
loadsound (bumpsound, "bump.wav") //load the bumpsound
`loadsound (growsound, "grow.wav") //load the growsound
loadsound (endsound, "end.wav") //load the end jingle
loadsound (pausesound, "pause.wav") //load the pause sound
//*********music***************
loadmusic(mainbgm, "lucid_dream.mp3")
loadmusic(transbgm, "trans.mp3")
loadmusic(GObgm, "gm1.mp3")
//**********creation of arrays***************
//create the array for the enemy spickly sprites
for s = 1 to spikecount - 1
spike[s].spritenum = spickly + s //set a new sprite number for each spickly sprite in the array
spike[s].alive = 0 //set the defualt state of each spickly sprite so that it is not active
spike[s].physics = 0 //make sure that all the sprites phycis are off by defalt
spike[s].spritenum = createsprite (enemyimage) //create the spickly spritei
setspriteanimation( spike[s].spritenum, 40, 50, 21 )
setspriteoffset (spike[s].spritenum, 20, 25 ) //set the spickly offset point
setspritepositionbyoffset (spike[s].spritenum, -9999, -9999 ) //place the spickly out of the screen view based on its offset
setspritedepth (spike[s].spritenum, 3) //set the jellys depth
setspriteshape (spike[s].spritenum, 3) //set the collision shape of each spickly enemy to a cirle
`setspriteframe(spike[s].spritenum, random(1,3))
enemycount = enemycount + 1 //variable that counts the number of currently active enemy sprites on the screen
next s
//create the array for the enemy spickly sprites
for t = 0 to transcount
trans[t].spritenum = transsprite + t //set a new sprite number for each spickly sprite in the array
trans[t].alive = 0 //set the defualt state of each spickly sprite so that it is not active
createsprite(trans[t].spritenum, transimage ) //create the spickly spritei
setspriteanimation( trans[t].spritenum, 64, 128, 2 )
setspriteoffset (trans[t].spritenum, 32, 64 ) //set the spickly offset point
setspritepositionbyoffset (trans[t].spritenum, -9999, -9999 ) //place the spickly out of the screen view based on its offset
setspritedepth (trans[t].spritenum, 3)
setspriteframe(trans[t].spritenum, random(1,2))
setspritecolor(trans[t].spritenum, random(0, 255),random(0, 255),random(0, 255), 255 )
next t
//create the array for the enemy spickly sprites
for b = 0 to barcount
bar[b].spritenum = barsprite + b //set a new sprite number for each spickly sprite in the array
bar[b].spritenum = createsprite (barimage) //create the spickly spritei
bar[b].alive = 0
setspriteoffset (bar[b].spritenum, 1, 1 ) //set the spickly offset point
setspritepositionbyoffset (bar[b].spritenum, -9999, -9999 ) //place the spickly out of the screen view based on its offset
setspritedepth (bar[b].spritenum, 0) //set the jellys depth
next b
//array for the
for p = 0 to partcount
part[p].spritenum = partparticle + p
part[p].imagenum = partimage
part[p].spritenum = createparticles(-9999,-9999)
SetParticlesStartZone( part[p].spritenum, -5, -5, 5, 5)
setparticlesimage(part[p].spritenum, partimage) //set all the partilce images
setparticlesdepth (part[p].spritenum, 0) //set the level at which the particles will be layerd
SetParticlesDirection ( part[p].spritenum, 80 , 80 ) //set the x and y speed at which the partices will travel
SetParticlesAngle ( part[p].spritenum, 360 ) //make sure to spread the partilces in all derictions, 360 degrees
SetParticlesFrequency ( part[p].spritenum, 50 ) //set the rate at which each particles appears
SetParticlesLife ( part[p].spritenum, 0.5 ) //set the timer the partilces can be on the screen for
SetParticlesSize ( part[p].spritenum, 25 ) //set the size of the particles
setparticlesmax ( part[p].spritenum, random(5, 7)) //set the maxium time particles can be generated
AddParticlesColorKeyFrame ( part[p].spritenum, 0.0, 255, 255, 255, 255 ) //set the particle sprites to there start color with minimal alhpa
AddParticlesColorKeyFrame ( part[p].spritenum, 0.3, 255, 255, 255, 150 ) //set partilce sprites to there middle color
AddParticlesColorKeyFrame ( part[p].spritenum, 0.4, 255, 255, 255, 0) //make partilces invisible at the end on there life with a different color
next p
//create the array for the enemy spickly sprites
for f = 1 to flyerscount
flyers[f].spritenum = flyersprite + f //set a new sprite number for each spickly sprite in the array
flyers[f].alive = 0 //set the defualt state of each spickly sprite so that it is not active
createsprite (flyers[f].spritenum, flyerimage) //create the spickly spritei
setspriteanimation( flyers[f].spritenum, 32, 32, 4)
setspriteoffset (flyers[f].spritenum, 16, 16 ) //set the spickly offset point
setspritepositionbyoffset (flyers[f].spritenum, -9999, -9999 ) //place the spickly out of the screen view based on its offset
setspritedepth (flyers[f].spritenum, 3) //set the jellys depth
setspriteshape (flyers[f].spritenum, 3) //set the collision shape of each spickly enemy to a cirle
next f
//change the game state after verything has been loaded
gamestate$ = "play"
endfunction
then here is the code used to actually scroll them:
function screenscroll()
//create the first scrolling background image
if getspriteexists(BG1sprite) = 0
createsprite(BG1sprite, BG1image)
setspritedepth (BG1sprite, 10)
setspriteposition (BG1sprite, 0, BG1Y)
endif
BGspriteUOffset# = 0 / BGimageW#
BGspriteVOffset# = BG1Y / BGimageH#
setSpriteUVOffset( BG1sprite , -BGspriteUOffset# , -BGspriteVOffset# )
//create the first scrolling background image
if getspriteexists(sidesprite) = 0
createsprite(sidesprite, sideimage)
setspritedepth (sidesprite, 5)
setspriteposition (sidesprite, 0, BG3y)
`setSpriteUVScale( sidesprite , sideUscale# , sideVscale# )
endif
//create the first scrolling background image
if getspriteexists(fsidesprite) = 0
createsprite(fsidesprite, sideimage)
setspritedepth (fsidesprite, 5)
setspriteposition (fsidesprite, BG2x, BG3y)
setspriteflip(fsidesprite, 1, 0)
endif
//create the first scrolling background image
if getspriteexists(side2sprite) = 0
createsprite(side2sprite, side2image)
setspritedepth (side2sprite, 6)
setspriteposition (side2sprite, 0, BG4y)
`setSpriteUVScale( sidesprite , sideUscale# , sideVscale# )
endif
//create the first scrolling background image
if getspriteexists(fside2sprite) = 0
createsprite(fside2sprite, side2image)
setspritedepth (fside2sprite, 6)
setspriteposition (fside2sprite, BG3x, BG4y)
setspriteflip(fside2sprite, 1, 0)
endif
//if the game is in the transfer state of the game then increase the speed of the background
if gamestate$ = "transfer"
//increase the rate of screen scroll once the transfer process starts to take place
if transtimer < 500 then BGspeed = BGspeed + 0.1
else
//normalize the BGspeed
BGspeed = 1.0
endif
`if BGtimer > 0
` BGtimer = BGtimer - 1
`` BGfade = BGfade - 1.5
`else
` If BGtimer = -100 then BGtimer = 100
` BGtimer = BGtimer - 1
` BGfade = BGfade + 1.5
`endif
if BGfade >= 1 then setspritecoloralpha(sidesprite, BGfade)
if BGfade >= 1 then setspritecoloralpha(fsidesprite, BGfade)
if BGfade >= 1 then setspritecoloralpha(side2sprite, BGfade)
if BGfade >= 1 then setspritecoloralpha(fside2sprite, BGfade)
//increase the y-axis position of the first background image
BG1y = BG1y + BGspeed
if gamestate$ <> "transfer"
BG3Y = BG3Y + (BGspeed*2)
BG4Y = BG4Y + (BGspeed*1.7)
// Use UV Offset to scroll background in sync with test sprite position
spriteUOffset# = BG1X / sideimageW#
spriteVOffset# = BG3Y / sideimageH#
fspriteUOffset# = BG1X / sideimageW#
fspriteVOffset# = BG3Y / sideimageH#
setSpriteUVOffset( sidesprite , -spriteUOffset# , -spriteVOffset# )
setSpriteUVOffset( fsidesprite , -fspriteUOffset# , -fspriteVOffset# )
sprite2UOffset# = BG1X / side2imageW#
sprite2VOffset# = BG4Y / side2imageH#
fsprite2UOffset# = BG3X / side2imageW#
fsprite2VOffset# = BG4Y / side2imageH#
setSpriteUVOffset( side2sprite , -sprite2UOffset# , -sprite2VOffset# )
setSpriteUVOffset( fside2sprite , -fsprite2UOffset# , -fsprite2VOffset# )
else
BGfade = BGfade - 5
BG1x = BG1x - 0.5
BG2x = BG2x + 0.5
endif
//track the first background images position and reset it once it hits a certain spot
`if BG1y >= 500.0 then BG1y = -500.0
`setspriteposition (BG1sprite, 0, BG1y)
//increase the y-axis position of the secound background image
BG2y = BG2y + BGspeed
if gamestate$ <> "transfer"
`BG4y = BG4y + (BGspeed*2)
else
BG1x = BG1x - 0.5
BG2x = BG2x + 0.5
endif
//track the secound background images position and reset it once it hits a certain spot
if BG2y >= 500.0 then BG2y = -500.0
`setspriteposition (BG2sprite, 0, BG2y)
//The possiblity of having cloud particles to create a parralax scrolling effect
endfunction
thanks,
//simpleprogram
Programming and video games, what else could you need?