Hi.
I wrote a code that when click on sprite, Rescale it to custom size.
but I have a Problem when use SetSpriteScale. mean when I set my sprite to custom size (256,184) like below code, show normal size.
rem Landscape App
SetDisplayAspect( -1 )
#constant DeviceWidth = GetDeviceWidth()
#constant DeviceHeight = GetDeviceHeight()
spr = CreateSprite(0)
SetSpriteSize (spr,256.0/DeviceWidth*100,184.0/DeviceHeight*100)
SetSpritePositionByoffset(spr,50,50)
do
Sync()
loop
but when I use SetSpriteScaleByOffset() for increase Sprite size, it rescale my sprite to big size.like below code:
in this code I set my original size to (50x30) and I want after click on it, increase scale to (256x184).
rem Landscape App
SetDisplayAspect( -1 )
#constant DeviceWidth = GetDeviceWidth()
#constant DeviceHeight = GetDeviceHeight()
global sprw# = 0
global sprh# = 0
global scale = 0
spr = CreateSprite(0)
SetSpriteSize (spr,50.0/DeviceWidth*100,36.0/DeviceHeight*100)
SetSpritePositionByoffset(spr,50,50)
do
PX# = GetPointerX()
PY# = GetPointerY()
//Increase Scale
if GetSpriteHitTest(spr,ScreenToWorldX(PX#),ScreenToWorldY(PY#)) = 1
if GetPointerPressed () = 1
if scale = 0
scale = 1
endif
endif
endif
if scale = 1
if sprw# <= (256.0-50.0) then sprw# = sprw# + 2.0
if sprh# <= (184.0-30.0) then sprh# = sprh# + 2.0
SetSpriteScaleByOffset(spr,sprw#/DeviceWidth*100,sprh#/DeviceHeight*100)
endif
Sync()
loop
for rescale it I can use setSpritesize but I want know how work SetSpriteScaleByOffset() command.
SetSpriteSize(spr,sprw#/DeviceWidth*100,sprh#/DeviceHeight*100)
endif
Please Guide Me.
Thanks.