Recent Posts

Pages: [1] 2 3 ... 10
QB64 Discussion / Re: Collision Detection & Handling
« Last post by SkyCharger001 on May 30, 2017, 02:16:33 am »
A few tips:
A. compress the various arrays into a few TYPEd arrays. This makes it easier to determine what goes with what.
B. if you do this, then it might be a good idea to give the Character-type a 1-frame collision feedback buffer and backup-coordinates.
NPC-12 frame 9:
attempt 1, buffer 0000, up, gives collision, req reset
attempt 2, buffer 0001, right, gives collision, req reset
attempt 3, buffer 0011, down, gives collision, req reset
attempt 4, buffer 0111, left, gives collision, req reset
attempt 5, buffer 1111, stay (those NPCs that reach this point have no other choice, so requesting it has little purpose)
NPC-12 frame 10:
attempt 1, buffer 0000, up, no collision, req stay
attempt 2, buffer 0000, up, no collision, req stay (some other NPC had a collision)
attempt 3, buffer 0000, up, no collision, req stay
NPC-12 frame 11:
C. set up the player character as simply a specific member (#0 for example) of this type. (something I've used in most of my attempts at a top-down game, as it reduces the amount of duplicate code required and makes it easier IMHO to fairplay the NPCs as you can simply make them use the same control hooks as the player character)
It's been a while since I've heard of a system that can't do full-screen properly.

- Is it just QB64 programs, or any program? You might like to try if you don't have a game or similar handy to run fullscreen.
- What hardware are we dealing with?
- The usual: make sure your drivers are up to date. Make sure dxdiag.exe doesn't report any problems (QB64 doesn't use DirectX, but there still should not be any errors there).
- Try setting the window to a resolution that matches your monitor's native and then go fullscreen.
- See if windows 10 is set to zoom in everything (under Settings -> Display or similar). One chap reported issues with window sizes with this setting set to a value other than 100%. No idea why it would affect full-screen, but we're stabbing in the dark here.
- General advice: ignore Clippy and SkyCharger.
what's your criteria for calling a solution working? 90%, 95%, 98% or (most likely it seems, as impossible as it is to achieve) 100% with no margin for error?
QB64 Discussion / Re: Collision Detection & Handling
« Last post by jc3bull on May 30, 2017, 01:06:04 am »
Okay, so I have the idea now to detect the collision before it happens. To do this with TerryRichie's Sprite Library you must make them collide to get a collision flag. So what I did was temporarily move the sprite 4 pixels to up/down/left/right and then detect the collision and if it detects one then stop the character movement for the direction he's moving and reset the sprite position. Well, it should work in theory, but it doesn't. I am back to having the two sprites get stuck together and it seems that the game is not detecting the sprite collisions. I've attached my code. Please help!
Sample Programs / Multiple XOR with Escrow Agent
« Last post by artmaker43 on May 29, 2017, 08:03:08 pm »
Let's assume that I have a file, text document (or any other type), that I only want to be accessed by two people who have to work together to access it with a third person acting as an escrow agent. For this example, I will call the file Original.txt. Here are the steps to accomplish this:

1. Get the EXACT length in bytes of the file you wish them to access together.
2. Make two (2) DIFFERENT random files that are each the same EXACT length as this file.
3. Name these two (2) DIFFERENT random files Key1.dat and Key2.dat
4. XOR Key1.dat with Key2.dat = MasterKey.dat
5. XOR Original.txt with MasterKey.dat = Escrow.dat
6. Give the Escrow.dat file to the escrow agent
7. Give Person One the Key1.dat file
8. Give Person Two the Key2.dat file

Now, Person One and Person Two can only read the Original.txt by working in unison with the escrow agent:

Person One:
Give the Key1.dat file to the escrow agent

Person Two:
Give the Key2.dat file to the escrow agent

Escrow agent:
1. XOR Key1.dat with Key2.dat = MasterKey.dat
2. XOR Escrow.dat with MasterKey.dat = Duplicate.txt (Same as Original.txt)
3. Give the Duplicate.txt to Person One and Person Two

My two programs that I used can be downloaded here:

Random File Maker:

XOR File Encryption:

The attached zip file contains an example I created plus the "How-To-Do-It" documentation.
does it work? NO, just like most of your other helpless hints...
Beginner's Help / Re: Handling Enter as Input
« Last post by Pete on May 29, 2017, 01:35:49 pm »
I made this for someone who wanted a clock running all the time. INPUT would stop a visible clock display, so what was needed was a custom key input routine. Now it uses ENTER to input the typed characters, but it could be modified to automatically trigger that response when the variable, word$, is a certin length, a certain value, etc.

If you need a custom key input routine, give this a try. If you need help modifying it, let us know what you want to trigger an automatic ENTER response and hopefully someone or I will be around to help you modify it.

Oh, you will see the clock running in the center of the TITLE BAR, not in the program window.

Code: [Select]
maxspaces% = 40
WIDTH 80, 25
    LOCATE 10, 5
    PRINT "Input Name: ";
    showcursor% = 7 ' Use 7 to show the cursor or zero to hide it. A value of 30 makes it a small square.

    CALL getinput(word$, maxspaces%, limitinput$, showcursor%, autoenter%)

    LOCATE 12, 5: PRINT "The input is now in the variable word$ as: "
    LOCATE 14, 41 - LEN(word$) / 2 ' Centers the print in the next line.
    PRINT word$

    ' Now here is another way to use the sub and keep the clock running.
    LOCATE 16, 5
    PRINT "Try again? Y/N "; ' Remember to always use a ";" after the print statement to keep your input on the same line.
    limitinput$ = "YyNn"
    autoenter% = 1 ' Automatically enter response after one key is pressed.
    maxspaces% = 10
    showcursor% = 0 ' Hide the cursor for yes/no responses.

    CALL getinput(word$, maxspaces%, limitinput$, showcursor%, autoenter%)

    limitinput$ = "" ' Always erase variable for other uses.
    autoenter% = 0 ' Always erase variable for other uses.
    IF LCASE$(word$) = "n" THEN END

SUB getinput (word$, maxspaces%, limitinput$, showcursor%, autoenter%)
' Input Statement with clock.
startpos% = POS(0)
endpos% = startpos% + maxspaces%
word$ = "" ' Erases last entry to begin next entry.
LOCATE , , 1, 7, showcursor%

    IF TIME$ >= "12:00:00" THEN
        TIME1 = ASC(MID$(TIME$, 1, 1)) - 1
        TIME2 = ASC(MID$(TIME$, 2, 1)) - 2
        IF TIME2 < 48 THEN TIME2 = TIME2 + 10: TIME1 = TIME1 - 1
        TIMECONV$ = CHR$(TIME1) + CHR$(TIME2) + MID$(TIME$, 3, LEN(TIME$)) + " PM"
        TIMECONV$ = MID$(TIME$, 1, 8) + " AM"
    END IF
    IF MID$(TIMECONV$, 1, 2) = "00" THEN MID$(TIMECONV$, 1, 2) = "12"

    ' KEY INPUT GOES HERE....................................................

    IF autoenter% THEN
        ' Used for a non-enter response, like answering yes or no.
        IF LEN(word$) = autoenter% THEN EXIT SUB
    END IF

    mykey$ = INKEY$

    IF mykey$ <> "" THEN
        yy% = CSRLIN: xx% = POS(0)

        SELECT CASE mykey$
            CASE CHR$(0) + "K"
                mov% = -1: GOSUB action
            CASE CHR$(0) + "M"
                mov% = 1: GOSUB action
            CASE CHR$(0) + "S"
                GOSUB wash: GOSUB delete
            CASE CHR$(0) + "R"
                IF ins% = 0 THEN ins% = -1 ELSE ins% = 0
                IF ins% = 0 THEN LOCATE , , 1, 7, 7 ELSE LOCATE , , 1, 7, 30
            CASE CHR$(0) + "O"
                IF word$ <> "" THEN LOCATE yy%, startpos% + LEN(word$)
            CASE CHR$(0) + "G"
                LOCATE yy%, startpos%
            CASE CHR$(8)
                IF xx% > startpos% THEN
                    LOCATE , POS(0) - 1
                    xx% = POS(0)
                    GOSUB wash: GOSUB delete
                END IF
            CASE CHR$(13)
                ' Exits the input sub back to your main program.
                EXIT SUB
            CASE CHR$(27)
                ' Quit and removes program winsow.
            CASE CHR$(32) TO CHR$(126)
                IF INSTR(limitinput$, mykey$) OR limitinput$ = "" THEN
                    key$ = mykey$
                    GOSUB action
                    BEEP ' Input error, retry.
                END IF
        END SELECT
        mov% = 0: key$ = ""
    END IF

IF POS(0) + mov% >= startpos% AND POS(0) + mov% < endpos% THEN
        IF key$ <> "" THEN
            SELECT CASE ins%
                CASE 0
                    IF LEN(word$) + LEN(key$) > endpos% - startpos% THEN EXIT DO
                    word$ = MID$(word$, 1, POS(0) - startpos%) + key$ + MID$(word$, POS(0) - startpos% + 1)
                CASE -1
                    word$ = MID$(word$, 1, POS(0) - startpos%) + key$ + MID$(word$, POS(0) - startpos% + 2)
            END SELECT
        END IF
        IF POS(0) - startpos% >= LEN(word$) - LEN(key$) AND key$ <> "" OR key$ = "" OR ins% = -1 THEN
            IF key$ = "" AND mov% = 1 THEN IF POS(0) - startpos% = LEN(word$) THEN EXIT DO
            LOCATE , POS(0) + mov%: PRINT key$;
            LOCATE yy%, startpos%: PRINT MID$(word$, 1, xx% - startpos%); key$;: xx2% = POS(0): PRINT MID$(word$, xx% - startpos% + 2);: LOCATE yy%, xx2%
        END IF
        EXIT DO

IF POS(0) >= startpos% AND word$ <> "" AND POS(0) - startpos% < LEN(word$) THEN
    LOCATE yy%, startpos% + LEN(word$) - 1
    PRINT " ";
    LOCATE yy%, xx%

IF POS(0) - startpos% = 0 THEN
    word$ = MID$(word$, 2)
    word$ = MID$(word$, 1, POS(0) - startpos%) + MID$(word$, POS(0) - startpos% + 2)
PRINT MID$(word$, xx% - startpos% + 1);: LOCATE yy%, xx%

Pete  :)

Your welcome, congrats for your Hello 2.0  8)
You clearly need reading glasses.
the video-card isn't being delayed, it's being given the chance to actually finish its work before it gets the next image to work with.
Pages: [1] 2 3 ... 10