Hi,
When I looked at the code, it appears that the the offset is set for the stars, but the *ByOffset functions weren't being called.
Please don't rip me a new one if I'm wrong - as I'm still new at this
Here's the full code after updating those few things. When I preview it, everything appears to work just fine.
rem
rem AGK Application
rem
rem Landscape App
SetDisplayAspect( 4.0/3.0 )
rem first create an array to store the spriteID's in
dim spriteArray[100]
rem load media
loadImage(1,"star.png")
loadImage(2,"MoonDogShip.png")
loadImage(3,"MoonDogShip_jet3.png")
loadImage(4,"MoonDogShip_jet2.png")
loadImage(5,"MoonDogShip_jet1.png")
rem create spaceship
frame = 2
ship = createSprite(0)
AddSpriteAnimationFrame(ship, 2)
AddSpriteAnimationFrame(ship, 3)
AddSpriteAnimationFrame(ship, 4)
AddSpriteAnimationFrame(ship, 5)
setSpriteSize(ship,6,-1)
setSpriteOffset(ship,3,getSpriteHeight(ship)/2)
setSpritePositionByOffset(ship,50,50)
setSpriteDepth(ship,50)
fixSpriteToScreen(ship,1)
rem now create 100 sprites
for s=1 to 100
rem create a sprite
spr = createSprite(1)
rem get a random depth between 1 and 100
d = random(1,100)
rem set the sprite size and depth
setSpriteDepth(spr,d)
setSpriteSize(spr,1.0-(d/100.0),-1)
rem set it at a random position in our world
setSpritePosition(spr,random(0,100),random(0,100))
rem add to the array
spriteArray[s] = spr
next
rem A Wizard Did It!
do
rem get the view offset
vx# = getViewOffsetX()
vy# = getViewOffsetY()
rem loop through 100 sprites
for s=1 to 100
spr = spriteArray[s]
d# = getSpriteDepth(spr)
`set the sprite offsets based on the view offset
Xoff# = -(d#-100.0)*0.01*vx#
Yoff# = -(d#-100.0)*0.01*vy#
setSpriteOffset(spr,Xoff#,Yoff#)
`check it's still on screen
wx# = GetSpriteXByOffset(spr)
wy# = GetSpriteYByOffset(spr)
sx# = worldToScreenX(wx#)
sy# = worldToScreenY(wy#)
`if not then give it a new position
if sx#<0 then SetSpritePositionByOffset(spr,wx#+100,wy#)
if sx#>100 then SetSpritePositionByOffset(spr,wx#-100,wy#)
if sy#<0 then SetSpritePositionByOffset(spr,wx#,wy#+100)
if sy#>100 then SetSpritePositionByOffset(spr,wx#,wy#-100)
next
rem adjust the view with the ship
x# = getDirectionX()
y# = -getDirectionY()*0.2
a# = getSpriteAngle(ship)
setSpriteAngle(ship,a#+x#)
setViewOffset(getViewOffsetX()+y#*cos(90-a#),getViewOffsetY()-y#*sin(90-a#)*getDisplayAspect())
rem animate the ship
if abs(y#)>0.1
frame = frame+1
if frame>4 then frame=2
else
frame = 1
endif
setSpriteFrame(ship,frame)
sync()
loop