editor jumps annorying on "no file" on exit.

Previous topic - Next topic

spacefractal

how do I detect if a sprite exists or not, whithout the editor jump to that line on exists... which is pretty annoyring.

I use something like this:

GETSPRITESIZE t, XX, YY

And if XX is 0, I asume there is no sprite here and do some code here.

If a do its on a TRY command, the editor just annoyring jump there instead.

I hate when the editor jump to these commands on exists, so I need to scroll where I was code every time, when I known there is no bug here......

I need to find a with to detect if a sprite exists or not WITHOUT these annoyring jumps.

PS. It might have caused by LOADSPRITE when no file found, but I dont think that is a issue, but using DOESFILEEXIST now instead to avoid that editor jump.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Moru

Do you have some code example on how you do it?

MrTAToad

Sounds like you need to use GENSPRITE() to find the first free sprite.

spacefractal

#3
the code its self works as it should.

This is just do I wanted to automatic load the files with might have varied length of animations.

I now use this:

Code (glbasic) Select

FOR r=1 TO MAXANIMHEADS
FOR i=1 TO 10
t=r*10+i-1
A$="headtile_"+r+"_"+i+".png"
IF DOESFILEEXIST(A$)=1
DEBUG A$+" "+t+"\n"
LOADSPRITE A$, t
ELSE
BREAK
ENDIF
NEXT
NEXT


In the old code, I loaded the sprite regaardless the file was exists or not, then use BREAK when the size of sprite was zero. The code elsewise ran fine, but just jump into the GETSPRITESIZE command (after the LOAD command)after the app exists....

PS. Im are aware of the GENSPRITE(), but is not required in this app.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kitty Hello

I don't get it. What's the problem again?