Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CHALLANGE ! Dangerous Maze
#11
Code: (Select All)
INSTR(, _OS$, "[WINDOWS]")
'^ ^
'| |

Do not do this because QB64 doesn't like it. No need for that stray comma if the starting position of the string is not needed in the search.

Yes it is a PITA to have to reserve a string variable or constant for the directory separation character. But I'm with Terry, do something like this:

Code: (Select All)
'near beginning of top-level code
DIM dirsep$

$IF WIN THEN
dirsep$ = "\"
$ELSE
dirsep$ = "/"
$END IF

'later in the program:
uni_bord = _LOADIMAGE(osFix$("need" + dirsep$ + "menu" + dirsep$ + "bord" + dirsep$ + "uni_bord.jpg"), 32)

It looks sloppy, however. It might be better to do what justsomeguy proposed. To call a "helper" string function that changes the slash character depending on the operating system the program is running in.
Reply
#12
Thank you very much for the answers! I wanted to elegantly solve it, as Justsomeguy suggested, by having a function return the correct string, which is the filename. Unfortunately, I use file operations in a lot of places and I wanted to eliminate errors, so I changed the "\" to a variable with a simple character replacement. I always try to use 'native' solutions, it seemed the easiest. Thank you all for your help!

I hope I didn't mess anything up, and now the game runs without any problems on Linux. I changed the download link in the very first post, the game is available there.

Thanks again !
Reply
#13
For those who are running old versions of QB64.

Code: (Select All)
PRINT osFix("need\menu\bord\uni_bord.jpg")

FUNCTION osFix$ (in AS STRING)
    DIM iter AS LONG
    DIM char AS STRING
    DIM fixed AS STRING
    fixed = in
    FOR iter = 1 TO LEN(in)
        char = MID$(in, iter, 1)
        IF INSTR(_OS$, "[WINDOWS]") THEN
            IF char = "/" THEN
                MID$(fixed, iter) = "\"
            END IF
        ELSE
            IF INSTR(_OS$, "[LINUX]") OR INSTR(_OS$, "[MACOSX]") THEN
                IF char = "\" THEN
                    MID$(fixed, iter) = "/"
                END IF
            END IF
        END IF
    NEXT
    osFix = fixed
END FUNCTION
Reply
#14
Auto fps does not work well on all computers. For some people, the display freezes even if they write a high fps in vain. That's why I set it to be automatic (what the machine can handle) or 25,30,40,50,60 can be selected. If the game crashed for anyone, try it now.

I added the 3D spatial effect, which can be used to perceive the front and back.
I increased the excitement by changing the background music when I needed to hurry.
I tried to get the most out of the sound effects.

I also added textures.
Overall, I think it's really done now. I wanted it to run on every machine.

Download in the first post.
Reply




Users browsing this thread: 1 Guest(s)