Quote: "I wouldn't expect a single new sprite to affect the frame rate that much, how did you add it? "
This works best with draw sprite!
rem
rem AGK Application
rem
rem Landscape App
setorientationallowed(0,0,1,0)
setsyncrate(0,0)
REM // original snes mostly used 256x224
SetVirtualResolution(320, 240)
#Constant ScrWidth 320
#Constant ScrHeight 240
global mapSpriteNumber,Kart_Sprite
REM // Prepare the track sprite
mapImageNumber = LoadImage("Mario_Circuit_1.png")
SetImageMagFilter( mapImageNumber, 0 )
SetImageMinFilter( mapImageNumber, 0 )
mapSpriteNumber = CreateSprite(mapImageNumber)
SetSpritePosition(mapSpriteNumber, 0, 0)
SetSpriteAngle(mapSpriteNumber, -90)
SetSpriteActive ( mapSpriteNumber, 0 )
REM // Prepare our kart
Kart_Image = LoadImage("kart.png")
Kart_Speed#=120.0
Kart_Turn_Speed#=120.0
SetImageMagFilter( Kart_Image, 0 )
SetImageMinFilter( Kart_Image, 0 )
Kart_Sprite = CreateSprite(Kart_Image)
fixspritetoscreen(Kart_Sprite,1)
setspritesize(Kart_Sprite,64,64)
SetSpriteAnimation( Kart_Sprite, 32, 32, 4 )
SetSpritePosition(Kart_Sprite, ( ScrWidth/2 )-32, ScrHeight-64)
X#=0.0
Y#=0.0
ang#=0.0
SetViewZoomMode(1)
global GFT#
do
GFT# = GetFrameTime()
zoom# = 8.0
Setspritevisible(mapSpriteNumber,1)
for i = ScrHeight to 80 step -1
SetSpritepositionbyOffset( mapSpriteNumber, ScreenToWorldX( ScrWidth/2 ) , ScreenToWorldY( ScrHeight ) )
SetViewZoom(zoom#)
SetScissor(0, i, ScrWidth, i + 1)
Render()
zoom# = zoom# - 0.05
if zoom#<0.2 then exit
next i
Setspritevisible(mapSpriteNumber,0)
//scroll the world
if GetDirectionY() <-0.02
X#=X# + (cos(ang#) * (Kart_Speed#*GFT#))
Y#=Y# + (sin(ang#) * (Kart_Speed#*GFT#))
endif
if GetDirectionY() >0.02
X#=X# - (cos(ang#) * (Kart_Speed#*GFT#))
Y#=Y# - (sin(ang#) * (Kart_Speed#*GFT#))
endif
SetViewOffset( X#, Y# )
SetSpriteOffset( mapSpriteNumber, ScreenToWorldX( ScrWidth/2 ) , ScreenToWorldY( ScrHeight ) )
setspriteframe(Kart_Sprite,1)
//rotate the map
if GetDirectionX() <-0.02
SetSpriteAngle(mapSpriteNumber, GetSpriteAngle(mapSpriteNumber) + (Kart_Turn_Speed#*GFT#))
ang#=ang#- (Kart_Turn_Speed#*GFT#)
setspriteframe(Kart_Sprite,3)
endif
if GetDirectionX() >0.02
SetSpriteAngle(mapSpriteNumber, GetSpriteAngle(mapSpriteNumber) - (Kart_Turn_Speed#*GFT#))
ang#=ang#+ (Kart_Turn_Speed#*GFT#)
setspriteframe(Kart_Sprite,2)
endif
print("Fps = "+str( Screenfps() ) )
//print("x = "+str( X# ) + " y = "+str( Y# ))
//print("x = "+str( ScreenToWorldX( ScrWidth/2 ) ) + " y = "+str( ScreenToWorldY( 240 ) ))
REM // Show and draw kart sprite
Setspritevisible(Kart_Sprite,1)
drawsprite(Kart_Sprite)
REM // Grabb the whole screen so we get the kart and all the text
SetScissor(0, ScrHeight, ScrWidth,0)
Render()
REM // Hide kart sprite saves framerate
Setspritevisible(Kart_Sprite,0)
// escape on computer and back button on device
if GetRawKeyState(27)=1 then end
Sync()
loop
If i show and hide the sprite so do i get lower framerate.
If i dont hide it before the large set scissor loop so do i get extremely low framerate.