Hi all.
Every game i attempt to make, at some point suffers with slow downs. It'll be fine at 60fps, then it'll drop rapidly to 30, and then slowly until things come to a crawl and the game crashes.
What are the main issues that could be causing FPS drops?
I realise you can't see my code, and there isn't much tbh, but i use a lot of functions. CreateBackDrop () would probably house loadimage, create sprite, set pos, depth, etc and then i'll call the function if lets say 'Start Game' Text was hit. Is this the right way to do things? I don't have much in the actual Main 'Do Loop' bar functions that house the majority of my code.
Edit; Incase this is the issue. I would have a function; Start Game for example, which would then house other functions that would load game controls and the like. Is this bad coding?
EDIT Final update - Oki, seems just running the programme, and leaving it as the start screen, with nothing loaded kills the frames until it crashes... Must be my system? It's a laptop i5, 2.5gz cpu, 8gig ram, intel Hd 3000 as the display. Windows 7. This shouldn't be a problem.
An example of the code:
function intro()
intro = createtext("Play")
SetTextPosition(intro, sW / 2, sH / 6)
settextsize(intro, 50)
SetTextAlignment(Intro, 1) // iMode - The aligment mode to use. 0=left, 1=center, 2=right
if GetTextHitTest(intro, GetPointerX(), GetPointerY()) and GetPointerPressed()=1
startGame()
endif
endfunction
function startGame()
SetViewOffset(sW,0)
backDropImg = LoadImage("land/forest.png")
bdSpr = createsprite(backDropImg)
SetSpriteSize(bdSpr, sW,sH)
FixSpriteToScreen(bdSpr, 1) //mode - 1=screen sprite, 0=world sprite
loadRobot()
endfunction
function loadRobot()
createsprite(1,pBotImg)
AddSpriteAnimationFrame (1,LoadImage("side view/robot_blueDrive1.png"))
AddSpriteAnimationFrame (1,LoadImage("side view/robot_blueDrive2.png"))
SetSpritePosition(1, sW + sW/4, sH - sH/2)
playsprite(1,10,1)
endfunction
Khadin