Quote: "The offset is altered by the scale of the box; which it really (I believe) should not be to allow for consistency in positioning.
I hope this makes sense..."
Ah, now I understand. Unfortunately it's just the nature of the beast. When the sprites offset is that far off (anywhere really) and the scale changes it does its best to maintain the same offset distance relative to the sprite. When the sprite is made smaller it moves the sprite closer to the offset (without changing the offset numbers) to appear to be the same distance.
The same is true with anything 3D as an object goes away from the camera it appears to be smaller and any gaps in the object that are huge when close to the camera appear to be smaller and smaller the farther away the object moves.
The only thing I suggest is using pre-made sprite scales rather than using SCALE SPRITE. You can more easily predict where a sprite will be when the sprite is any size you've predetermined. This code snip now changes the image number used for the sprite when you use the mouse wheel rather than SCALE SPRITE like before.
` Set the sync rate and turn on syncing
sync rate 0
sync on
` Create a screen with two white lines showing the center
line 0,screen height()/2,screen width(),screen height()/2
line screen width()/2,0,screen width()/2,screen height()
` Grab the image (used for background)
get image 1,0,0,screen width(),screen height(),1
` Set starting sprite offsets
XOffset=100
YOffset=-50
` Set the starting box size
x2=200
` Make several boxes (each one smaller than the other)
for t=2 to 50
box x1,x1,x2,x2,rgb(0,255,0),rgb(0,255,0),rgb(0,0,255),rgb(0,0,255)
get image t,0,0,200,200,1
ink 0,0
box x1,y1,x2,x2
dec x2,2
inc x1,2
next t
ink rgb(255,255,255),0
` Set the starting current image
CImage=2
` Make the box a sprite
sprite 1,0,0,CImage
` Offset the sprite
offset sprite 1,XOffset,YOffset
` Create a timer
tim=timer()
` Create another timer (for the arrow keys)
keytim=timer()
` Grab the current state of the mouse wheel
MouseWheel=mousez()
do
` Show the background
paste image 1,0,0
` Show the sprite at the center of the screen
paste sprite 1,screen width()/2,screen height()/2
` Show the sprite at the mouse coordinates using the current image
sprite 1,mousex(),mousey(),CImage
` Show the sprites current offsets and the variable offsets
text 0,0,"Sprite Offset X = "+str$(sprite offset x(1))
text 0,20,"Sprite Offset Y = "+str$(sprite offset y(1))
text 0,40,"Current Image Number = "+str$(CImage)
` Check if it's time to rotate the sprite
if timer()>tim+5
` Increase the angle
inc Angle
` Rotate the sprite
rotate sprite 1,wrapvalue(Angle)
` Reset timer
tim=timer()
endif
` Check if the mouse wheel is changed
if mousez()>MouseWheel or mousez()<MouseWheel
` Determine which way the mousewheel is going
Direction=MouseWheel-mousez()
` Reset MouseWheel
MouseWheel=mousez()
` Mouse wheel up (positive number)
if Direction>0
` Decrease the current image number
dec CImage
` Make sure the current image number is no less than 2
if CImage=1 then CImage=2
endif
` Mouse wheel down (negative number)
if Direction<0
` Increase the current image number
inc CImage
` Make sure the current image number is no more than 50
if CImage>50 then CImage=50
endif
endif
` Check if it's time to check for arrow keys
if timer()>keytim+100
` Check for left arrow
if keystate(203) then dec XOffset
` Check for right arrow
if keystate(205) then inc XOffset
` Check for up arrow
if keystate(200) then dec YOffset
` Check for down arrow
if keystate(208) then inc YOffset
` Offset the sprite to the new offset
offset sprite 1,XOffset,YOffset
` Reset the key timer
keytim=timer()
endif
sync
loop
