This is a separate issue than 604. I have not submitted a bug on this one.
There are more issues than you are aware of that have not been resolved by me posting snippets. I am also referring to DBPro issues from the past.
I have already been deleting the .byc, sourcecode.txt and the .exe files whenever I have issues. This exercise does not remedy this particular issue.
To what Google issue are you referring?
This issue has to do with the AppGameKit assigning a value to the sprite ID. I allow it to assign the values on its own, I do not assign any. But after compiling there is an error that 10002 does not exist within the same function/code as it was assigned two or three lines earlier. As I have mentioned in my original post, this has only happened using particles as I have been using several sprites in this project and a previous project without any issues like this.
For those of you that automatically assume that I do not troubleshoot before posting, I have spent 5 hours on this today trying to find out why the error occurs the way that it does. I have gotten it to work without error by having the particles created after the animated sprite. If I create them before the animated sprite then I get the error. So the error would have to be in the particle function. But when you look at the particle function it is just like the example code that came with the product, except that I am allowing the compiler to assign the IDs instead of assigning them myself.
Since everyone needs to see code without the associated files that may be affecting the results... here ya go...
#INCLUDE "quarks.agc"
TYPE _clickArea_
clickUpper
clickLeft
clickLower
clickRight
ENDTYPE
TYPE _size_
X
Y
ENDTYPE
TYPE _menuScreen_
areaMenu AS _clickArea_
sprMENU_BG
ENDTYPE
TYPE _menuButton_
sprButton
posButtonX
posButtonY
sizeButton AS _size_
fileButton AS STRING
areaButton AS _clickArea_
ENDTYPE
#CONSTANT menButtons 5
DIM menuButton[menBUTTONS] AS _menuButton_
menuButton[0].fileButton="buttonSave" `SAVE button
menuButton[1].fileButton="buttonLoad" `LOAD button
menuButton[2].fileButton="buttonNew" `NEW button
menuButton[3].fileButton="buttonConcur" `Concur button
menuButton[4].fileButton="buttonQuit" `Quit button
GLOBAL CREATE_MENU_BACKGROUND=1
CreateText(1,"")
SetTextDepth( 1, 0 )
SetTextSize ( 1, 15 )
SetTextColor ( 1,255,255,255,255 )
SetTextPosition(1,textX,(t*15)+textY)
screenSize AS _size_
vidSize AS _size_
screenSize.X=1280
screenSize.Y=720
vidSize.X=450
vidSize.Y=253
SetVirtualResolution(screenSize.X,screenSize.Y)
MenuCASE$=MENU(screenSize)
WHILE GetPointerPressed()=0
SetTextString(1,MenuCASE$)
SetTextVisible(1,1)
Sync()
ENDWHILE
END
FUNCTION MENU(screenSize AS _size_)
REM *********** MENU buttons **************
vidSize AS _size_
vidSize.X=640
vidSize.Y=360
posButtons AS _size_
posButtons.X=150
posButtons.Y=50
IF CREATE_MENU_BACKGROUND=1
menuScreen AS _menuScreen_
REM !!!!! If you rem the CREATE_PARTICLES function all works fine
REM !!!!! If you leave it in you will get a sprite doesn't exist error no matter when it is called
REM !!!!! In my original code this happens only if it occurs first, if it is
// called after CREATE_MENU_BG function then there is no error
REM I have performed testing on both sets of code several times over the course of 4 hours and have consistant results
menuScreen=CREATE_MENU_BG(vidSize,screenSize,200)
`CREATE_PARTICLES(screenSize)
CREATE_MENU_BACKGROUND=0
ENDIF
CREATE_MENU_BUTTONS(menuScreen,posButtons)
PlaySprite(menuScreen.sprMENU_BG)
DO
MX=GetPointerX()
MY=GetPointerY()
withinButton=0
FOR b=0 to menBUTTONS-1
IF (MX>menuButton[b].areaButton.clickLeft AND MX< menuButton[b].areaButton.clickRight AND MY> menuButton[b].areaButton.clickUpper AND MY< menuButton[b].areaButton.clickLower)
SetSpriteFrame (menuButton[b].sprButton,2)
withinButton=1
selectedButton=b
IF GetPointerPressed()=1
IF selectedButton=0 AND GameLoaded=0
buttonSelected=0
ELSE
buttonSelected=1
ENDIF
EXIT
ENDIF
ELSE
SetSpriteFrame (menuButton[b].sprButton,1)
ENDIF
NEXT b
IF withinButton=1 AND buttonSelected=1 THEN EXIT
Sync()
start#=Timer()
elapsed#=0
WHILE elapsed#<0.05
elapsed#=Timer()-start#
ENDWHILE
LOOP
REM Clean-up
FOR cButton=0 to menBUTTONS-1
DeleteSprite(menuButton[cButton].sprButton)
NEXT cButton
StopSprite(menuScreen.sprMENU_BG)
DeleteSprite(menuScreen.sprMENU_BG)
REM *************** Button Action **********************
SELECT selectedButton
CASE 0 `SAVE
IF GAMELOADED=1
`SaveFile$=SAVE_MENU()+".sav"
MenuCASE$="SAVE"
`SAVE_GAME(SaveFile$,numParameters,numLocations)
ENDIF `GAMELOADED=1
ENDCASE
CASE 1 `LOAD
MenuCASE$="LOAD"
`LoadFile$=LOAD_MENU()+".sav"
`LOCATION_INITIALIZE(LoadFile$)
newLocation=1
GAMELOADED=1
ENDCASE
CASE 2 `NEW
MenuCASE$="NEW"
`LOCATION_INITIALIZE("SAVES\LocationArrayDefault.dat")
GAMELOADED=1
ENDCASE
CASE 3 `CONCUR
MenuCASE$="CONCUR"
ENDCASE
CASE 4 `QUIT
MenuCASE$="QUIT"
ENDCASE
ENDSELECT `xButton
ENDFUNCTION MenuCASE$ `MENU(numParameters,numLocations)
FUNCTION CREATE_MENU_BG(vidSize AS _size_,screenSize AS _size_,numFrames)
menuScreen AS _menuScreen_
menuScreen.areaMenu.clickUpper=(screenSize.Y/2)-(vidSize.Y/2)
menuScreen.areaMenu.clickLeft=(screenSize.X/2)-(vidSize.X/2)
menuScreen.areaMenu.clickLower=menuScreen.areaMenu.clickUpper+vidSize.Y
menuScreen.areaMenu.clickRight=menuScreen.areaMenu.clickLeft+vidSize.X
menuScreen.sprMENU_BG=CreateSprite(LoadImage("background\MENU_BG_0000.jpg"))
SetSpriteSize(menuScreen.sprMENU_BG,vidSize.X,vidSize.Y)
SetSpritePosition(menuScreen.sprMENU_BG,menuScreen.areaMenu.clickLeft,menuScreen.areaMenu.clickUpper)
SetSpriteSpeed(menuScreen.sprMENU_BG,24)
SetSpriteDepth(menuScreen.sprMENU_BG,1)
FOR frame=1 TO numFrames-1
IF frame<10 THEN frameIndex$="000"+STR(frame)
IF frame>9 AND frame<100 THEN frameIndex$="00"+STR(frame)
IF frame>99 AND frame<1000 THEN frameIndex$="0"+STR(frame)
IF frame>999 AND frame<10000 THEN frameIndex$=STR(frame)
SetTextString(1,frameIndex$)
SYNC()
frameIMG=LoadImage("background\MENU_BG_"+frameIndex$+".jpg")
AddSpriteAnimationFrame(menuScreen.sprMENU_BG,frameIMG)
NEXT frame
ENDFUNCTION menuScreen
FUNCTION CREATE_PARTICLES(screenSize AS _size_)
sprParticle=CreateParticles(screenSize.X/2, 0 )
SetParticlesImage(sprParticle,LoadImage("star.png" ) )
SetParticlesStartZone ( sprParticle, -screenSize.X/2, 10, screenSize.X/2, 10 )
SetParticlesDirection ( sprParticle, 0, 5.0 )
SetParticlesLife ( sprParticle, 45 )
SetParticlesSize ( sprParticle, 15 )
SetParticlesAngle ( sprParticle, 60 )
SetParticlesFrequency ( sprParticle, 5 )
SetParticlesVelocityRange ( sprParticle, 1, 4 )
SetParticlesColorInterpolation( sprParticle, 1 )
SetSpriteDepth( sprParticle, 2 )
AddParticlesForce(sprParticle,30,40,5,0)
AddParticlesColorKeyFrame ( sprParticle, 0, 0, 0, 0, 2 )
AddParticlesColorKeyFrame ( sprParticle, 3, 0, 100, 100, 200 )
AddParticlesColorKeyFrame ( sprParticle, 15, 0, 50, 255, 255 )
AddParticlesColorKeyFrame ( sprParticle, 30.0, 120, 0, 100, 255 )
AddParticlesColorKeyFrame ( sprParticle, 37.0, 150, 0, 130, 255 )
AddParticlesColorKeyFrame ( sprParticle, 45.0, 0, 0, 0, 0 )
sprParticle2=CreateParticles(screenSize.X/2, screenSize.Y-10 )
SetParticlesImage(sprParticle2,LoadImage("star.png" ) )
SetParticlesStartZone ( sprParticle2, -screenSize.X/2, 10, screenSize.X/2, 10 )
SetParticlesDirection ( sprParticle2, 0, -5.0 )
SetParticlesLife ( sprParticle2, 45 )
SetParticlesSize ( sprParticle2, 15 )
SetParticlesAngle ( sprParticle2, 60 )
SetParticlesFrequency ( sprParticle2, 5 )
SetParticlesVelocityRange ( sprParticle2, 1, 4 )
SetParticlesColorInterpolation( sprParticle2, 1 )
SetSpriteDepth( sprParticle2, 3 )
AddParticlesForce(sprParticle2,30,40,-5,0)
AddParticlesColorKeyFrame ( sprParticle2, 0, 0, 0, 0, 2 )
AddParticlesColorKeyFrame ( sprParticle2, 3, 0, 100, 100, 200 )
AddParticlesColorKeyFrame ( sprParticle2, 15, 0, 50, 255, 255 )
AddParticlesColorKeyFrame ( sprParticle2, 30.0, 120, 0, 100, 255 )
AddParticlesColorKeyFrame ( sprParticle2, 37.0, 150, 0, 130, 255 )
AddParticlesColorKeyFrame ( sprParticle2, 45.0, 0, 0, 0, 0 )
ENDFUNCTION
FUNCTION CREATE_MENU_BUTTONS(menuScreen AS _menuScreen_,posButtons AS _size_)
FOR b=0 TO menBUTTONS-1
numSprFrames=2
menuButton[b].sprButton=CreateSprite(LoadImage("IMAGE\MENU\"+(menuButton[b].fileButton)+".png"))
menuButton[b].sizeButton.X=100
menuButton[b].sizeButton.Y=50
`SetTextString (b+1,"IMAGE\MENU\"+(menuButton[b].fileButton)+".png")
menuButton[b].posButtonX=menuScreen.areaMenu.clickLeft+posButtons.X
menuButton[b].posButtonY=(b*50)+menuScreen.areaMenu.clickUpper+posButtons.Y
menuButton[b].areaButton.clickLeft=menuButton[b].posButtonX
menuButton[b].areaButton.clickUpper=menuButton[b].posButtonY
menuButton[b].areaButton.clickRight= menuButton[b].areaButton.clickLeft+menuButton[b].sizeButton.X
menuButton[b].areaButton.clickLower=menuButton[b].areaButton.clickUpper+menuButton[b].sizeButton.Y
SetSpriteAnimation(menuButton[b].sprButton,menuButton[b].sizeButton.X, menuButton[b].sizeButton.Y,numSprFrames)
SetSpritePosition(menuButton[b].sprButton,menuButton[b].posButtonX,menuButton[b].posButtonY)
SetSpriteFrame(menuButton[b].sprButton,1)
SetSpriteDepth(menuButton[b].sprButton,0)
NEXT b
ENDFUNCTION numSprFrames
em
rem ----------*** AGK Setup File ***----------
rem
rem NOTE: This file is used by the core binary
rem to configure basic setup values required
rem prior to execution of the AGC source code.
rem No spaces allowed beyond this point:
rem Window title (delete to hide window bar)
title=My AGK Landscape Application
rem Specify the initial device width
width=1280
rem Specify the initial device height
height=720
// Specify whether to use fullscreen mode
fullscreen=0
I have left comments near the beginning of the MENU() function describing actions that allow the error and not allow the error. The suspect function is remmed out so that the codes execution will run just fine. By allowing that function (which adds particles) to run the Sprite not found error occurs.
www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)