You will need to set the image wrap as well.
SetImageWrapU()
SetImageWrapV()
The defaut is to clamp the last pixel but you will want to change it so that it wraps.
Here is a small function to demonstrate it.
The upper image is the default sprite.
The lower image is the sprite 'stretched 10 times.
When you click the mouse, the image is tiled 10 times to give the appearance of 10 sprites in a row but it is still just one.
SetWindowTitle( "Sprite_ImageTiler" )
SetWindowSize( 1024, 768, 0 )
// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
groundImage = loadImage( "Ground.png" )
ground1 = createSprite( groundImage )
ground2 = createSprite( groundImage )
SetImageWrapU( groundImage, 1 )
SetImageWrapV( groundImage, 1 )
SetSpritePosition( ground1, 10, 10 )
SetSpritePosition( ground2, 10, 100 )
SetSpriteScale( ground1, 1, 1 )
SetSpriteScale( ground2, 10, 1 )
do
if GetPointerPressed()
TileSprite( ground2, 10, 1 )
endif
Sync()
loop
function TileSprite( spriteNo as integer, x# as float, y# as float )
SetSpriteUVScale( spriteNo, 1.0/x#, 1.0/y# )
endfunction
[Edit] Added the sprite that I was using to demonstrate the code - not that it matters too much, you can use any sprite.
AGK V2 user - Tier 1 (mostly)