Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - PMACKAY

Pages: [1] 2 3 ... 13
1
Programs / Re: ascII almost smooth pixel scroll
« on: April 10, 2022, 09:56:42 am »
its supposed to show junk. was just a test to smooth scroll the screen. the random was just to show you can print to the screen easy using a similar routine. you can all do as you wish this. it was me messing about as i like to play around making stuff up.

you can change the screen size and size of the scroll quiet easy to make a maze game or ascii side scroller.  not difficult to convert to vertical

Screen _NewImage(40 * 8, 28 * 16, 256) and have it draw a box around the outside and paint it. that will give a border like a commodore64

you can change the font if you want also

screendata$(1) to screendata$(24) : just put in the data what you want eg. screendata$(?) = "your maze data". you can make a maze that you walk through but your man goes up and down why your scrolls in the direction you press make the map roll around and the maze harder.

you could make it draw a map and move monsters around like a PAC man why you gobble dots on a full rotating map. maybe remap the ASCII characters and print monsters chasing you. could maybe dig holes for monsters to fall in so you could run back over them but only dig a hole every 10 seconds. just a thought

it could be made to run much better but I like it.

everyone is right it is showing garbage. its on purpose as a demo. the random print of "/" is to show you how to locate x,y:print "whatever" as the screen updates on a timer. no need to print print:

2
Programs / ascII almost smooth pixel scroll
« on: April 08, 2022, 09:44:54 am »
just messing around with smooth scrolling ascii text mode..

screendata$(holds then entire screen map) no need to print to screen. use mid$ to store x,y data instead to screendata$

adjust the timer to adjust speed of frame being drawn

in screen draw routine take out dr%=0 in line 65 to have continued scroll
to disable wrap around change line 43 to b$=" " and line 57 to a$=" "

Screen _NewImage(32 * 8, 24 * 16, 256)

Timer On
On Timer(0.0066) GoSub MVE:
Randomize Timer
Dim screendata$(24)

For i = 1 To 24
    For j = 1 To 32
        screendata$(i) = screendata$(i) + Chr$(Int(Rnd(1) * 26) + 65)
    Next j
    Print screendata$(i)
Next i
Cls
dr% = 0
ZX% = 8
Do:
    If Int(Rnd(1) * 75500) = 100 Then GoSub RAND
    I$ = InKey$
    If I$ = "Q" Then dr% = 1: I$ = ""
    If I$ = "E" Then dr% = 2: I$ = ""
    If I$ = "W" Then dr% = 0: I$ = ""
Loop While I$ = ""
Timer Off
End

MVE:
If dr% = 0 Then
    For i = 1 To 24
        Color 1: _PrintString (ZX%, i * 16 - 15), screendata$(i)
        Color 2: Locate i, 1: Print "Û";: Locate i, 32: Print "Û";
    Next i
End If
If dr% = 1 Then
    For i = 1 To 24
        Color 1: _PrintString (ZX%, i * 16 - 15), screendata$(i)
        Color 2: Locate i, 1: Print "Û";: Locate i, 32: Print "Û";
    Next i
    ZX% = ZX% - 1
    If ZX% < 0 Then
        For i = 1 To 24
            A$ = Right$(screendata$(i), 31)
            B$ = Left$(screendata$(i), 1)
            screendata$(i) = A$ + B$
        Next i
        ZX% = 7
    End If
End If
If dr% = 2 Then
    For i = 1 To 24
        Color 1: _PrintString (ZX%, i * 16 - 15), screendata$(i)
        Color 2: Locate i, 1: Print "Û";: Locate i, 32: Print "Û";
    Next i
    ZX% = ZX% + 1
    If ZX% > 8 Then
        For i = 1 To 24
            A$ = Right$(screendata$(i), 1)
            B$ = Left$(screendata$(i), 31)
            screendata$(i) = A$ + B$
        Next i
        ZX% = 1
    End If
End If
_Display
dr% = 0
Return
RAND:
X = Int(Rnd(1) * 24 + 1)
Y = Int(Rnd(1) * 31 + 1)
Mid$(screendata$(X), Y, 1) = "\"
Return

3
Dim musicdata$(113): Open "voice1data" For Input As #1: Open "voice2data" For Input As #2: musicdata$(0) = "l10"
For i = 1 To 113: Input #1, v1$: Input #2, v2$: musicdata$(i) = v1$ + "," + v2$: Next i: Close #2: Close #1




Do
    For i = 0 To 113
        Play musicdata$(i)
    Next i
Loop While InKey$ = ""




how do i only get the buffer to play the notes one by one with the keyboard being read so once the keyboard press the key it stops. this is a title music....

4
i will post the code block tomorrow.

its pretty much a

get file with music data

open "musicdatavoice one",into music1$(): open "musicdatavoice two"into music2$()

all data is "o? n" for both

stored in music1$(i) and music2$(i)

i then have a loop

n = current position of note in music1 and music2

loop begin
play music1$(n),music2$(n)
check if key pressed. key pressed so end
if not n=n+1 but if n=719 n=1
goto loop begin

either way i will paste my code tomorrow.

play "MB AND MF" the same in qb64. both play as background.... needs to be played in foreground so stops when key is pressed

but the music continues to play... music should stop


i am playing tune as polysynth not mono. works great except for not stop playing when key pressed

all music is playing in background. no foreground. (need foreground) not buffered.

5
just a question:

on qb64 1.15 linux i have got a little routine as below

x=0
do
play a$(x),b$(x)
x=x+1
if x>719 then x=0
while inkey$="" loop
end

when i press a key it exits like it should but the problem with this it continues to play the two voice music on my pc speaker

i want it to imediatly stop play though. it buffers the music but i dont want it play when i press the key as this is my title screen music.

i want it to play two notes then check key. if key pressed then exit loop. stop playing else loop play next two notes
_delay does not fix

thank you for any advice.

6
Programs / Re: boulderdash update pmackay
« on: August 29, 2020, 10:47:04 pm »
ON TIMER(SCREENANI%, .04) GOSUB TIMER2   this is the speed the boulders fall... change the .04 to different numbers for various speeds. 1=1 second (very very slow) (.04 = normal speed) can be made to fall faster. no point being faster as the rocks will fall way too fast.




the following below is the entire game loop... this works as i have everything running from timers. so this is the main loop. turn on timers to play and turn them off when game ends. nothing else needed. :)

DO: _LIMIT 30: GOSUB FPS: LOOP UNTIL ESC% = -1 OR REXIT% = 2 OR MANDIED% = -1

everything in the game runs off timers. _limit 30 is used for the loop to free the processor. nothing more.

7
Programs / Re: boulderdash update pmackay
« on: August 29, 2020, 06:51:06 pm »
copy the bas file over the bas file in the zipped version and recompile. will fix the bugs on the butterflies and fireflies. (amoeba to be worked on as has a bug that does not kill fireflies or butterflies and they remain on under the rocks active). going to fix in the next few days. does not really affect game.

8
Programs / boulderdash update pmackay
« on: August 29, 2020, 05:39:48 pm »
this is just an update to my boulder dash. has some bug fixes. needed are the other files from the original file you have downloaded.

have included the zip from my original code for download.

still work in progress. but very playable

*** (update-1.13) Download the files below (boulderrtestrun.zip and BOULDERS13.bas). unzip the file in qb64. copy the BOULDERS13.bas in qb64 and compile.  updated file from 1st september 2020....

The update has got the Amoeba to recognize and fix the fireflies and butterflies from staying behind. now fixed. Amoeba still needed to detect when stuck (no where to move = trapped sequence). running from timer for now.



Code: Text: [Select]
  1.  

9
Programs / Boulderdash
« on: February 15, 2020, 04:39:38 am »
reworked on graphics (draw frame routine easier to read)

FPS1:
CLS
SELECT CASE ANIMATE%
    CASE 1
        FOR J% = 1 TO 40
            FOR I% = 1 TO 22
                B% = SCREENMEM%(J%, I%)
                SELECT CASE B%
                    CASE WALL: PUT (J% * 16, I% * 16), BORDER()
                    CASE BUTTERFLY: PUT (J% * 16, I% * 16), BUTTERFLY1()
                    CASE FIREFLY: PUT (J% * 16, I% * 16), FIREFLY1()
                    CASE DIRT: PUT (J% * 16, I% * 16), DIRT()
                    CASE DIAMOND: PUT (J% * 16, I% * 16), DIAMOND1()
                    CASE ROCK: PUT (J% * 16, I% * 16), ROCK()
                    CASE SPACE: PUT (J% * 16, I% * 16), EXPLODE4()
                    CASE BRICK1: PUT (J% * 16, I% * 16), BRICK1()
                    CASE AMOEBA: PUT (J% * 16, I% * 16), AMOEBA1()
                    CASE CRUMBLE: PUT (J% * 16, I% * 16), CRUMBLE()
                    CASE EXITCLOSED: PUT (J% * 16, I% * 16), WALLFLASH1()
                    CASE EXITDOOR: IF FLAG% = 1 THEN PUT (J% * 16, I% * 16), WALLFLASH1() ELSE PUT (J% * 16, I% * 16), WALLFLASH2()
                END SELECT
            NEXT I%
        NEXT J%
    CASE 2
        FOR J% = 1 TO 40
            FOR I% = 1 TO 22
                B% = SCREENMEM%(J%, I%)
                SELECT CASE B%
                    CASE WALL: PUT (J% * 16, I% * 16), BORDER()
                    CASE BUTTERFLY: PUT (J% * 16, I% * 16), BUTTERFLY2()
                    CASE FIREFLY: PUT (J% * 16, I% * 16), FIREFLY2()
                    CASE DIRT: PUT (J% * 16, I% * 16), DIRT()
                    CASE DIAMOND: PUT (J% * 16, I% * 16), DIAMOND2()
                    CASE ROCK: PUT (J% * 16, I% * 16), ROCK()
                    CASE SPACE: PUT (J% * 16, I% * 16), EXPLODE4()
                    CASE BRICK1: PUT (J% * 16, I% * 16), BRICK1()
                    CASE AMOEBA: PUT (J% * 16, I% * 16), AMOEBA2()
                    CASE CRUMBLE: PUT (J% * 16, I% * 16), CRUMBLE()
                    CASE EXITCLOSED: PUT (J% * 16, I% * 16), WALLFLASH1()
                    CASE EXITDOOR: IF FLAG% = 1 THEN PUT (J% * 16, I% * 16), WALLFLASH2() ELSE PUT (J% * 16, I% * 16), WALLFLASH2()
                END SELECT
            NEXT I%
        NEXT J%
    CASE 3
        FOR J% = 1 TO 40
            FOR I% = 1 TO 22
                B% = SCREENMEM%(J%, I%)
                SELECT CASE B%
                    CASE WALL: PUT (J% * 16, I% * 16), BORDER()
                    CASE BUTTERFLY: PUT (J% * 16, I% * 16), BUTTERFLY3()
                    CASE FIREFLY: PUT (J% * 16, I% * 16), FIREFLY3()
                    CASE DIRT: PUT (J% * 16, I% * 16), DIRT()
                    CASE DIAMOND: PUT (J% * 16, I% * 16), DIAMOND3()
                    CASE ROCK: PUT (J% * 16, I% * 16), ROCK()
                    CASE SPACE: PUT (J% * 16, I% * 16), EXPLODE4()
                    CASE BRICK1: PUT (J% * 16, I% * 16), BRICK1()
                    CASE AMOEBA: PUT (J% * 16, I% * 16), AMOEBA3()
                    CASE CRUMBLE: PUT (J% * 16, I% * 16), CRUMBLE()
                    CASE EXITCLOSED: PUT (J% * 16, I% * 16), WALLFLASH1()
                    CASE EXITDOOR: IF FLAG% = 1 THEN PUT (J% * 16, I% * 16), WALLFLASH1() ELSE PUT (J% * 16, I% * 16), WALLFLASH2()
                END SELECT
            NEXT I%
        NEXT J%
    CASE 4
        FOR J% = 1 TO 40
            FOR I% = 1 TO 22
                B% = SCREENMEM%(J%, I%)
                SELECT CASE B%
                    CASE WALL: PUT (J% * 16, I% * 16), BORDER()
                    CASE BUTTERFLY: PUT (J% * 16, I% * 16), BUTTERFLY4()
                    CASE FIREFLY: PUT (J% * 16, I% * 16), FIREFLY4()
                    CASE DIRT: PUT (J% * 16, I% * 16), DIRT()
                    CASE DIAMOND: PUT (J% * 16, I% * 16), DIAMOND4()
                    CASE ROCK: PUT (J% * 16, I% * 16), ROCK()
                    CASE SPACE: PUT (J% * 16, I% * 16), EXPLODE4()
                    CASE BRICK1: PUT (J% * 16, I% * 16), BRICK1()
                    CASE AMOEBA: PUT (J% * 16, I% * 16), AMOEBA4()
                    CASE CRUMBLE: PUT (J% * 16, I% * 16), CRUMBLE()
                    CASE EXITCLOSED: PUT (J% * 16, I% * 16), WALLFLASH1()
                    CASE EXITDOOR: IF FLAG% = 1 THEN PUT (J% * 16, I% * 16), WALLFLASH2() ELSE PUT (J% * 16, I% * 16), WALLFLASH2()
                END SELECT
            NEXT I%
        NEXT J%

    CASE 5
        FOR J% = 1 TO 40
            FOR I% = 1 TO 22
                B% = SCREENMEM%(J%, I%)
                SELECT CASE B%
                    CASE WALL: PUT (J% * 16, I% * 16), BORDER()
                    CASE BUTTERFLY: PUT (J% * 16, I% * 16), BUTTERFLY5()
                    CASE FIREFLY: PUT (J% * 16, I% * 16), FIREFLY5()
                    CASE DIRT: PUT (J% * 16, I% * 16), DIRT()
                    CASE DIAMOND: PUT (J% * 16, I% * 16), DIAMOND5()
                    CASE ROCK: PUT (J% * 16, I% * 16), ROCK()
                    CASE SPACE: PUT (J% * 16, I% * 16), EXPLODE4()
                    CASE BRICK1: PUT (J% * 16, I% * 16), BRICK1()
                    CASE AMOEBA: PUT (J% * 16, I% * 16), AMOEBA5()
                    CASE CRUMBLE: PUT (J% * 16, I% * 16), CRUMBLE()
                    CASE EXITCLOSED: PUT (J% * 16, I% * 16), WALLFLASH1()
                    CASE EXITDOOR: IF FLAG% = 1 THEN PUT (J% * 16, I% * 16), WALLFLASH1() ELSE PUT (J% * 16, I% * 16), WALLFLASH2()
                END SELECT
            NEXT I%
        NEXT J%
    CASE 6
        FOR J% = 1 TO 40
            FOR I% = 1 TO 22
                B% = SCREENMEM%(J%, I%)
                SELECT CASE B%
                    CASE WALL: PUT (J% * 16, I% * 16), BORDER()
                    CASE BUTTERFLY: PUT (J% * 16, I% * 16), BUTTERFLY6()
                    CASE FIREFLY: PUT (J% * 16, I% * 16), FIREFLY6()
                    CASE DIRT: PUT (J% * 16, I% * 16), DIRT()
                    CASE DIAMOND: PUT (J% * 16, I% * 16), DIAMOND6()
                    CASE ROCK: PUT (J% * 16, I% * 16), ROCK()
                    CASE SPACE: PUT (J% * 16, I% * 16), EXPLODE4()
                    CASE BRICK1: PUT (J% * 16, I% * 16), BRICK1()
                    CASE AMOEBA: PUT (J% * 16, I% * 16), AMOEBA6()
                    CASE CRUMBLE: PUT (J% * 16, I% * 16), CRUMBLE()
                    CASE EXITCLOSED: PUT (J% * 16, I% * 16), WALLFLASH1()
                    CASE EXITDOOR: IF FLAG% = 1 THEN PUT (J% * 16, I% * 16), WALLFLASH2() ELSE PUT (J% * 16, I% * 16), WALLFLASH2()
                END SELECT
            NEXT I%
        NEXT J%
    CASE 7
        FOR J% = 1 TO 40
            FOR I% = 1 TO 22
                B% = SCREENMEM%(J%, I%)
                SELECT CASE B%
                    CASE WALL: PUT (J% * 16, I% * 16), BORDER()
                    CASE BUTTERFLY: PUT (J% * 16, I% * 16), BUTTERFLY7()
                    CASE FIREFLY: PUT (J% * 16, I% * 16), FIREFLY7()
                    CASE DIRT: PUT (J% * 16, I% * 16), DIRT()
                    CASE DIAMOND: PUT (J% * 16, I% * 16), DIAMOND7()
                    CASE ROCK: PUT (J% * 16, I% * 16), ROCK()
                    CASE SPACE: PUT (J% * 16, I% * 16), EXPLODE4()
                    CASE BRICK1: PUT (J% * 16, I% * 16), BRICK1()
                    CASE AMOEBA: PUT (J% * 16, I% * 16), AMOEBA7()
                    CASE CRUMBLE: PUT (J% * 16, I% * 16), CRUMBLE()
                    CASE EXITCLOSED: PUT (J% * 16, I% * 16), WALLFLASH1()
                    CASE EXITDOOR: IF FLAG% = 1 THEN PUT (J% * 16, I% * 16), WALLFLASH1() ELSE PUT (J% * 16, I% * 16), WALLFLASH2()
                END SELECT
            NEXT I%
        NEXT J%
    CASE 8
        FOR J% = 1 TO 40
            FOR I% = 1 TO 22
                B% = SCREENMEM%(J%, I%)
                SELECT CASE B%
                    CASE WALL: PUT (J% * 16, I% * 16), BORDER()
                    CASE BUTTERFLY: PUT (J% * 16, I% * 16), BUTTERFLY8()
                    CASE FIREFLY: PUT (J% * 16, I% * 16), FIREFLY8()
                    CASE DIRT: PUT (J% * 16, I% * 16), DIRT()
                    CASE DIAMOND: PUT (J% * 16, I% * 16), DIAMOND8()
                    CASE ROCK: PUT (J% * 16, I% * 16), ROCK()
                    CASE SPACE: PUT (J% * 16, I% * 16), EXPLODE4()
                    CASE BRICK1: PUT (J% * 16, I% * 16), BRICK1()
                    CASE AMOEBA: PUT (J% * 16, I% * 16), AMOEBA8()
                    CASE CRUMBLE: PUT (J% * 16, I% * 16), CRUMBLE()
                    CASE EXITCLOSED: PUT (J% * 16, I% * 16), WALLFLASH1()
                    CASE EXITDOOR: IF FLAG% = 1 THEN PUT (J% * 16, I% * 16), WALLFLASH2() ELSE PUT (J% * 16, I% * 16), WALLFLASH2()
                END SELECT
            NEXT I%
        NEXT J%

END SELECT
_DISPLAY
RETURN

also fixed error in code for Fireflys and Butterflies. Now working as should. similar to original. but works great. (not copy is my own original code).. infarct all code is mine. 

FIREFLYMOVE:
FTAD% = 1
FOR FTAD% = 1 TO 100
    SELECT CASE FIREFLYD(FTAD%)
        CASE 0
            GOTO FIREFLYPASSMOVE
        CASE 1 ' UP
            FBUT%% = SCREENMEM%((FIREFLYY(FTAD%)), FIREFLYX(FTAD%) - 1)
            FCUT%% = SCREENMEM%((FIREFLYY(FTAD%) - 1), FIREFLYX(FTAD%))
            FDUT%% = SCREENMEM%((FIREFLYY(FTAD%) + 1), FIREFLYX(FTAD%))
            IF FCUT%% = SPACE THEN SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = SPACE: FIREFLYY(FTAD%) = FIREFLYY(FTAD%) - 1: SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = FIREFLY: FIREFLYD(FTAD%) = 2: GOTO FIREFLYPASSMOVE
            IF FBUT%% = SPACE THEN SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = SPACE: FIREFLYX(FTAD%) = FIREFLYX(FTAD%) - 1: SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = FIREFLY: FIREFLYD(FTAD%) = 1: GOTO FIREFLYPASSMOVE
            IF FDUT%% = SPACE THEN SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = SPACE: FIREFLYY(FTAD%) = FIREFLYY(FTAD%) + 1: SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = FIREFLY: FIREFLYD(FTAD%) = 4: GOTO FIREFLYPASSMOVE
            FIREFLYD(FTAD%) = 3
        CASE 2 ' LEFT
            FBUT%% = SCREENMEM%((FIREFLYY(FTAD%) - 1), FIREFLYX(FTAD%))
            FCUT%% = SCREENMEM%((FIREFLYY(FTAD%)), FIREFLYX(FTAD%) + 1)
            FDUT%% = SCREENMEM%((FIREFLYY(FTAD%)), FIREFLYX(FTAD%) - 1)
            IF FCUT%% = SPACE THEN SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = SPACE: FIREFLYX(FTAD%) = FIREFLYX(FTAD%) + 1: SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = FIREFLY: FIREFLYD(FTAD%) = 3: GOTO FIREFLYPASSMOVE
            IF FBUT%% = SPACE THEN SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = SPACE: FIREFLYY(FTAD%) = FIREFLYY(FTAD%) - 1: SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = FIREFLY: FIREFLYD(FTAD%) = 2: GOTO FIREFLYPASSMOVE
            IF FDUT%% = SPACE THEN SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = SPACE: FIREFLYX(FTAD%) = FIREFLYX(FTAD%) - 1: SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = FIREFLY: FIREFLYD(FTAD%) = 1: GOTO FIREFLYPASSMOVE
            FIREFLYD(FTAD%) = 4
        CASE 3 'DOWN
            FBUT%% = SCREENMEM%((FIREFLYY(FTAD%)), FIREFLYX(FTAD%) + 1)
            FCUT%% = SCREENMEM%((FIREFLYY(FTAD%) + 1), FIREFLYX(FTAD%))
            FDUT%% = SCREENMEM%((FIREFLYY(FTAD%) - 1), FIREFLYX(FTAD%))
            IF FCUT%% = SPACE THEN SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = SPACE: FIREFLYY(FTAD%) = FIREFLYY(FTAD%) + 1: SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = FIREFLY: FIREFLYD(FTAD%) = 4: GOTO FIREFLYPASSMOVE
            IF FBUT%% = SPACE THEN SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = SPACE: FIREFLYX(FTAD%) = FIREFLYX(FTAD%) + 1: SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = FIREFLY: FIREFLYD(FTAD%) = 3: GOTO FIREFLYPASSMOVE
            IF FDUT%% = SPACE THEN SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = SPACE: FIREFLYY(FTAD%) = FIREFLYY(FTAD%) - 1: SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = FIREFLY: FIREFLYD(FTAD%) = 2: GOTO FIREFLYPASSMOVE
            FIREFLYD(FTAD%) = 1
        CASE 4 'RIGHT
            FBUT%% = SCREENMEM%((FIREFLYY(FTAD%) + 1), FIREFLYX(FTAD%))
            FCUT%% = SCREENMEM%((FIREFLYY(FTAD%)), FIREFLYX(FTAD%) - 1)
            FDUT%% = SCREENMEM%((FIREFLYY(FTAD%)), FIREFLYX(FTAD%) + 1)
            IF FCUT%% = SPACE THEN SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = SPACE: FIREFLYX(FTAD%) = FIREFLYX(FTAD%) - 1: SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = FIREFLY: FIREFLYD(FTAD%) = 1: GOTO FIREFLYPASSMOVE
            IF FBUT%% = SPACE THEN SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = SPACE: FIREFLYY(FTAD%) = FIREFLYY(FTAD%) + 1: SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = FIREFLY: FIREFLYD(FTAD%) = 4: GOTO FIREFLYPASSMOVE
            IF FDUT%% = SPACE THEN SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = SPACE: FIREFLYX(FTAD%) = FIREFLYX(FTAD%) + 1: SCREENMEM%(FIREFLYY(FTAD%), FIREFLYX(FTAD%)) = FIREFLY: FIREFLYD(FTAD%) = 3: GOTO FIREFLYPASSMOVE
            FIREFLYD(FTAD%) = 2
            FIREFLYPASSMOVE:
    END SELECT
NEXT FTAD%
'GOSUB FPS1
RETURN

BUTTERMOVE:
TAD% = 1
FOR TAD% = 1 TO 100
    SELECT CASE BUTTERFLYD(TAD%)
        CASE 0
            GOTO PASSMOVE
        CASE 3 ' UP
            BUT% = SCREENMEM%((BUTTERFLYY(TAD%)), BUTTERFLYX(TAD%) - 1)
            CUT% = SCREENMEM%((BUTTERFLYY(TAD%) + 1), BUTTERFLYX(TAD%))
            DUT% = SCREENMEM%((BUTTERFLYY(TAD%) - 1), BUTTERFLYX(TAD%))
            IF CUT% = SPACE THEN SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = SPACE: BUTTERFLYY(TAD%) = BUTTERFLYY(TAD%) + 1: SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = BUTTERFLY: BUTTERFLYD(TAD%) = 4: GOTO PASSMOVE
            IF BUT% = SPACE THEN SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = SPACE: BUTTERFLYX(TAD%) = BUTTERFLYX(TAD%) - 1: SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = BUTTERFLY: BUTTERFLYD(TAD%) = 1: GOTO PASSMOVE
            IF DUT% = SPACE THEN SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = SPACE: BUTTERFLYY(TAD%) = BUTTERFLYY(TAD%) - 1: SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = BUTTERFLY: BUTTERFLYD(TAD%) = 2: GOTO PASSMOVE
            BUTTERFLYD(TAD%) = 1
        CASE 2 ' LEFT
            BUT% = SCREENMEM%((BUTTERFLYY(TAD%) - 1), BUTTERFLYX(TAD%))
            CUT% = SCREENMEM%((BUTTERFLYY(TAD%)), BUTTERFLYX(TAD%) - 1)
            DUT% = SCREENMEM%((BUTTERFLYY(TAD%)), BUTTERFLYX(TAD%) + 1)
            IF CUT% = SPACE THEN SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = SPACE: BUTTERFLYX(TAD%) = BUTTERFLYX(TAD%) - 1: SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = BUTTERFLY: BUTTERFLYD(TAD%) = 1: GOTO PASSMOVE
            IF BUT% = SPACE THEN SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = SPACE: BUTTERFLYY(TAD%) = BUTTERFLYY(TAD%) - 1: SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = BUTTERFLY: BUTTERFLYD(TAD%) = 2: GOTO PASSMOVE
            IF DUT% = SPACE THEN SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = SPACE: BUTTERFLYX(TAD%) = BUTTERFLYX(TAD%) + 1: SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = BUTTERFLY: BUTTERFLYD(TAD%) = 3: GOTO PASSMOVE
            BUTTERFLYD(TAD%) = 4
        CASE 1 'DOWN
            BUT% = SCREENMEM%((BUTTERFLYY(TAD%)), BUTTERFLYX(TAD%) + 1)
            CUT% = SCREENMEM%((BUTTERFLYY(TAD%) - 1), BUTTERFLYX(TAD%))
            DUT% = SCREENMEM%((BUTTERFLYY(TAD%) + 1), BUTTERFLYX(TAD%))
            IF CUT% = SPACE THEN SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = SPACE: BUTTERFLYY(TAD%) = BUTTERFLYY(TAD%) - 1: SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = BUTTERFLY: BUTTERFLYD(TAD%) = 2: GOTO PASSMOVE
            IF BUT% = SPACE THEN SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = SPACE: BUTTERFLYX(TAD%) = BUTTERFLYX(TAD%) + 1: SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = BUTTERFLY: BUTTERFLYD(TAD%) = 3: GOTO PASSMOVE
            IF DUT% = SPACE THEN SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = SPACE: BUTTERFLYY(TAD%) = BUTTERFLYY(TAD%) + 1: SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = BUTTERFLY: BUTTERFLYD(TAD%) = 4: GOTO PASSMOVE
            BUTTERFLYD(TAD%) = 3
        CASE 4 'RIGHT
            BUT% = SCREENMEM%((BUTTERFLYY(TAD%) + 1), BUTTERFLYX(TAD%))
            CUT% = SCREENMEM%((BUTTERFLYY(TAD%)), BUTTERFLYX(TAD%) + 1)
            DUT% = SCREENMEM%((BUTTERFLYY(TAD%)), BUTTERFLYX(TAD%) - 1)
            IF CUT% = SPACE THEN SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = SPACE: BUTTERFLYX(TAD%) = BUTTERFLYX(TAD%) + 1: SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = BUTTERFLY: BUTTERFLYD(TAD%) = 3: GOTO PASSMOVE
            IF BUT% = SPACE THEN SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = SPACE: BUTTERFLYY(TAD%) = BUTTERFLYY(TAD%) + 1: SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = BUTTERFLY: BUTTERFLYD(TAD%) = 4: GOTO PASSMOVE
            IF DUT% = SPACE THEN SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = SPACE: BUTTERFLYX(TAD%) = BUTTERFLYX(TAD%) - 1: SCREENMEM%(BUTTERFLYY(TAD%), BUTTERFLYX(TAD%)) = BUTTERFLY: BUTTERFLYD(TAD%) = 1: GOTO PASSMOVE
            BUTTERFLYD(TAD%) = 2
            PASSMOVE:
    END SELECT
NEXT TAD%
GOSUB FPS1
GOSUB FIREFLYMOVE
RETURN




sprite data is written as

DATA 33333333300333033103333333333333,33333333300333033103333333333333,33333333300333033103333333333333,33333333300333033103333333333333: '          * BORDER (EDGE TILE)

colors are represented as 1=color 1      2=color 2      3=color3     0=bkground

data is read as left top (4x8), right top (4x8), bottom left (4x8), bottom right (4x8) all in 3 forground and 1 back ground. so four colours only
eg. blocks are 1=x2 block 2=x2 block 3=x2 block 0=bkg(nil colour)    4 dots wide x 8 dots down (grid is 4x8,4x8 =16 x 2 wide 23 down (16x23 character)

10
QB64 Discussion / Re: BoulderDash butterfly movement (AI).. QB64 pmackay
« on: November 23, 2019, 07:33:48 pm »
here is the test run in zip format. i am looking for someone who would like to help me debug my code, speed it up more and make this better than it is. I have included source code. its a mess. but fast and works.

* Needed to add are rock fall on man detection
* More monsters (bugs) - currently has two which are Fireflys and Butterflys
* Put all maps on harddisk rather than in same bin file
* Maybe different Music and Sound effects
* A tittle screen and score holding routines
* Recode the door for better detection, routine to open door when key got to open other area of screen
* Glow routine for glow around firefly (unsure how to go about this) without using too many frames

This is just a project I am doing for fun. anyway atleast i wont have to purchase a copy :) 
This is all my code. just messy and needs a good clean up.

11
QB64 Discussion / Re: BoulderDash butterfly movement (AI).. QB64 pmackay
« on: October 30, 2019, 08:02:41 am »
the below download is just my butterfly AI. Works great. Not included is the Firefly. Firefly is reverse pattern upside down. took me a day to work it out a pattern to replicate. I am not good with maths. but i got it. :)

12
QB64 Discussion / Re: BoulderDash butterfly movement (AI).. QB64 pmackay
« on: October 30, 2019, 07:56:02 am »
thhis draws one complete FRAME with 8x Frame Animated Blocks (8 x frames per cycle) very pretty when running. have demo version but not willing to share CODE as Still Writting game. but Superfast and fully animated. Including music and sound. will upload Linux64 bit bin it requested. (demo only)

All rocks-diamonds fall as per frame cycle so its cool to see them slide down off each other. the trick is to read the screen from bottom right to top left. move pieces down (not up) so the screen draws on cycle (frame) before re looping so full animation is achieved. which i have all graphics animated, rock and diamonds falling, monsters moving all in under one frame. up to 40 of each monster and entire screen is moved and calcuated in one frame.

I have six on timers running. looking at running another to achieve the door flash when you can exit... the butterflys and fireflys where harddest to program. but they run very fast. 40 of each so 80 in total. yet on my pc there is speed loss. keyboard also runs on a on timer so i fixed the problem of the key repeat being to fast. i call fps on a timer also so i can have more time available for maths. works sweet (run beautiful program the whole thing on timers)




FPS: CLS: FOR I% = 1 TO 40: FOR J% = 1 TO 22: B% = SCREENMEM%(J%, I%): SELECT CASE B%
        CASE WALL: PUT (I% * 8 - 1, J% * 16 - 16), WALL(): CASE SPACE: PUT (I% * 8 - 1, J% * 16 - 16), SPACE()
        CASE DIRT: PUT (I% * 8 - 1, J% * 16 - 16), DIRT(): CASE MAN: PUT (I% * 8 - 1, J% * 16 - 16), PLAYER()
        CASE BOULDER: PUT (I% * 8 - 1, J% * 16 - 16), BOULDER(): CASE BOULDERF: PUT (I% * 8 - 1, J% * 16 - 16), BOULDER()
        CASE BRICK: PUT (I% * 8 - 1, J% * 16 - 16), BRICK(): CASE EXITLEVEL: IF COLLECTED% >= TOCOLLECT% THEN PUT (I% * 8 - 1, J% * 16 - 16), REXIT(): REXIT% = 1 ELSE PUT (I% * 8 - 1, J% * 16 - 16), WALL()
            CASE PICKUPKEY: PUT (I% * 8 - 1, J% * 16 - 16), PICKUPKEY()
            CASE DOORCLOSE: PUT (I% * 8 - 1, J% * 16 - 16), DOORCLOSE()
            CASE DOOROPEN: PUT (I% * 8 - 1, J% * 16 - 16), DOOROPEN()
            END SELECT: SELECT CASE ANIMATION%
            CASE 1
                IF B% = DIAMOND THEN PUT (I% * 8 - 1, J% * 16 - 16), DIAMOND1()
                IF B% = FUNGUS THEN PUT (I% * 8 - 1, J% * 16 - 16), FUNGUS1()
                IF B% = FLUTTERFLY THEN PUT (I% * 8 - 1, J% * 16 - 16), FLUTTER1()
                IF B% = BOXER THEN PUT (I% * 8 - 1, J% * 16 - 16), BOXER1()
                IF B% = EXPLODEA THEN PUT (I% * 8 - 1, J% * 16 - 16), BOOM1()
                IF B% = EXPLODEB THEN PUT (I% * 8 - 1, J% * 16 - 16), BOOM1(): _SNDPLAY BOOMSOUND
                IF B% = MAJIC THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC1()
                IF B% = MAJICROCKROCK THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC1()
            CASE 2
                IF B% = DIAMOND THEN PUT (I% * 8 - 1, J% * 16 - 16), DIAMOND2()
                IF B% = FUNGUS THEN PUT (I% * 8 - 1, J% * 16 - 16), FUNGUS2()
                IF B% = FLUTTERFLY THEN PUT (I% * 8 - 1, J% * 16 - 16), FLUTTER2()
                IF B% = BOXER THEN PUT (I% * 8 - 1, J% * 16 - 16), BOXER2()
                IF B% = EXPLODEA THEN PUT (I% * 8 - 1, J% * 16 - 16), BOOM1()
                IF B% = EXPLODEB THEN PUT (I% * 8 - 1, J% * 16 - 16), BOOM1()
                IF B% = MAJIC THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC2()
                IF B% = MAJICROCK THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC2()
            CASE 3
                IF B% = DIAMOND THEN PUT (I% * 8 - 1, J% * 16 - 16), DIAMOND3()
                IF B% = FUNGUS THEN PUT (I% * 8 - 1, J% * 16 - 16), FUNGUS3()
                IF B% = FLUTTERFLY THEN PUT (I% * 8 - 1, J% * 16 - 16), FLUTTER3()
                IF B% = BOXER THEN PUT (I% * 8 - 1, J% * 16 - 16), BOXER3()
                IF B% = EXPLODEA THEN PUT (I% * 8 - 1, J% * 16 - 16), BOOM2()
                IF B% = EXPLODEB THEN PUT (I% * 8 - 1, J% * 16 - 16), BOOM2()
                IF B% = MAJIC THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC3()
                IF B% = MAJICROCK THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC3()
            CASE 4
                IF B% = DIAMOND THEN PUT (I% * 8 - 1, J% * 16 - 16), DIAMOND4()
                IF B% = FUNGUS THEN PUT (I% * 8 - 1, J% * 16 - 16), FUNGUS4()
                IF B% = FLUTTERFLY THEN PUT (I% * 8 - 1, J% * 16 - 16), FLUTTER4()
                IF B% = BOXER THEN PUT (I% * 8 - 1, J% * 16 - 16), BOXER4()
                IF B% = EXPLODEA THEN PUT (I% * 8 - 1, J% * 16 - 16), BOOM3()
                IF B% = EXPLODEB THEN PUT (I% * 8 - 1, J% * 16 - 16), BOOM3()
                IF B% = MAJIC THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC4()
                IF B% = MAJICROCK THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC4()
            CASE 5
                IF B% = DIAMOND THEN PUT (I% * 8 - 1, J% * 16 - 16), DIAMOND5()
                IF B% = FUNGUS THEN PUT (I% * 8 - 1, J% * 16 - 16), FUNGUS4()
                IF B% = FLUTTERFLY THEN PUT (I% * 8 - 1, J% * 16 - 16), FLUTTER5()
                IF B% = BOXER THEN PUT (I% * 8 - 1, J% * 16 - 16), BOXER5()
                IF B% = EXPLODEA THEN PUT (I% * 8 - 1, J% * 16 - 16), BOOM3()
                IF B% = EXPLODEB THEN PUT (I% * 8 - 1, J% * 16 - 16), BOOM3()
                IF B% = MAJIC THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC5()
                IF B% = MAJICROCK THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC5()
            CASE 6
                IF B% = DIAMOND THEN PUT (I% * 8 - 1, J% * 16 - 16), DIAMOND6()
                IF B% = FUNGUS THEN PUT (I% * 8 - 1, J% * 16 - 16), FUNGUS6()
                IF B% = FLUTTERFLY THEN PUT (I% * 8 - 1, J% * 16 - 16), FLUTTER6()
                IF B% = BOXER THEN PUT (I% * 8 - 1, J% * 16 - 16), BOXER6()
                IF B% = EXPLODEA THEN PUT (I% * 8 - 1, J% * 16 - 16), BOOM2()
                IF B% = EXPLODEB THEN PUT (I% * 8 - 1, J% * 16 - 16), BOOM2()
                IF B% = MAJIC THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC6()
                IF B% = MAJICROCK THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC6()
            CASE 7
                IF B% = DIAMOND THEN PUT (I% * 8 - 1, J% * 16 - 16), DIAMOND7()
                IF B% = FUNGUS THEN PUT (I% * 8 - 1, J% * 16 - 16), FUNGUS7()
                IF B% = FLUTTERFLY THEN PUT (I% * 8 - 1, J% * 16 - 16), FLUTTER7()
                IF B% = BOXER THEN PUT (I% * 8 - 1, J% * 16 - 16), BOXER7()
                IF B% = EXPLODEA THEN PUT (I% * 8 - 1, J% * 16 - 16), BOOM1()
                IF B% = EXPLODEB THEN PUT (I% * 8 - 1, J% * 16 - 16), BOOM1()
                IF B% = MAJIC THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC7()
                IF B% = MAJICROCK THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC7()
            CASE 8
                IF B% = DIAMOND THEN PUT (I% * 8 - 1, J% * 16 - 16), DIAMOND8()
                IF B% = FUNGUS THEN PUT (I% * 8 - 1, J% * 16 - 16), FUNGUS8()
                IF B% = FLUTTERFLY THEN PUT (I% * 8 - 1, J% * 16 - 16), FLUTTER8()
                IF B% = BOXER THEN PUT (I% * 8 - 1, J% * 16 - 16), BOXER8()
                IF B% = EXPLODEA THEN PUT (I% * 8 - 1, J% * 16 - 16), DIAMOND1(): SCREENMEM%(J%, I%) = DIAMOND
                IF B% = EXPLODEB THEN PUT (I% * 8 - 1, J% * 16 - 16), SPACE(): SCREENMEM%(J%, I%) = SPACE
                IF B% = MAJIC THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC8()
                IF B% = MAJICROCK THEN PUT (I% * 8 - 1, J% * 16 - 16), MAJIC8()
                IF MANDIED% = 1 THEN MANDIED% = -1
END SELECT: NEXT J%: NEXT I%: COLOR 34: LOCATE 23, 1: PRINT "CAVE - "; LEVEL; "     SCORE - "; SCORE%: PRINT "      LIVES - "; LIVES; " TIMER:"; MAJICCOUNT%;: LOCATE 1, 1: _DISPLAY: RETURN




TIMER1 = ANIMATION SPEED (ANIMATION = ANIMATION + 1) IF > 8 ANIMATION = 0 : TIMER SPEED IS .06  so i call this .06 times every 8 FPS call
TIMER2 = FPS (MAIN CALLER FOR FRAMES PER SECOND) SET TO .03 (=SMOOTH AND ANIMATED X 8 DIFERENT FRAMES PER SPRITE)
TIMER3 = KEYBOARD ROUTINE
TIMER4 = ROCKS AND DIAMONDS FALL ROUTINE
TIMER5 = BUTTERFLY MOVEMENT AI
TIMER6 = FIREFLY MOVEMENT AI
TIMER7 = AMOEBAE TIMER (RUNS FOR SEC COUNT)
TIMER8 = MAJIC TILES (DROP ROCK THROUGH AND RECEIVE A DIAMOND). ALSO DISABLE WHEN OUT OF TIME.
TIMER9 = LEVEL LENGTH COMPLETE
TIMER10 = FLASH EXIT WHEN GOT ENOUGH DIAMONDS

13
QB64 Discussion / BoulderDash butterfly movement (AI).. QB64 pmackay
« on: October 30, 2019, 07:36:52 am »
WIDTH 40
DIM a$(10), BX(10), BY(10), BD(10)
DIM SCREENMEM%(20, 9)
CONST BUTTERFLY = 1, SPACE = 32, WALL = 79
a$(1) = "wwwwwwwwwwwwwwwwwwww"
a$(2) = "w   .       .     .w"
a$(3) = "w .   .  .  . ... .w"
a$(4) = "w ......... . . .  w"
a$(5) = "w        .  .   .  w"
a$(6) = "w.......... ..... .w"
a$(7) = "wz                .w"
a$(8) = "w... ...   ........w"
a$(9) = "wwwwwwwwwwwwwwwwwwww"

TID% = 0
FOR I = 1 TO 10
    TID% = 0
    FOR J = 1 TO 9
        IF MID$(a$(J), I, 1) = "z" THEN TID% = TID% + 1: BX(TID%) = J: BY(TID%) = I: BD(TID%) = 1
    NEXT J
NEXT I
FOR J = 1 TO 9
    FOR I = 1 TO 20
        B$ = MID$(a$(J), I, 1)
        SCREENMEM%(I, J) = VAL(B$)
        LOCATE J, I: PRINT B$
    NEXT I
NEXT J
DO
    _LIMIT 20
    I$ = INKEY$: IF I$ = "Q" THEN EXIT DO
    GOSUB FPS
    GOSUB MOVE
LOOP
END
MOVE:
SELECT CASE BD(1)

    CASE 0
        GOTO PASSMOVE

    CASE 1 ' UP
        B$ = MID$(a$(BX(1) - 1), BY(1), 1)
        C$ = MID$(a$(BX(1)), BY(1) - 1, 1)
        D$ = MID$(a$(BX(1)), BY(1) + 1, 1)
        IF C$ = " " THEN MID$(a$(BX(1)), BY(1), 1) = " ": BY(1) = BY(1) - 1: MID$(a$(BX(1)), BY(1), 1) = "z": BD(1) = 2: GOTO PASSMOVE
        IF B$ = " " THEN MID$(a$(BX(1)), BY(1), 1) = " ": BX(1) = BX(1) - 1: MID$(a$(BX(1)), BY(1), 1) = "z": BD(1) = 1: GOTO PASSMOVE
        IF D$ = " " THEN MID$(a$(BX(1)), BY(1), 1) = " ": BY(1) = BY(1) + 1: MID$(a$(BX(1)), BY(1), 1) = "z": BD(1) = 4: GOTO PASSMOVE
        BD(1) = 3

    CASE 2 ' LEFT
        B$ = MID$(a$(BX(1)), BY(1) - 1, 1)
        C$ = MID$(a$(BX(1) + 1), BY(1), 1)
        D$ = MID$(a$(BX(1) - 1), BY(1), 1)
        IF C$ = " " THEN MID$(a$(BX(1)), BY(1), 1) = " ": BX(1) = BX(1) + 1: MID$(a$(BX(1)), BY(1), 1) = "z": BD(1) = 3: GOTO PASSMOVE
        IF B$ = " " THEN MID$(a$(BX(1)), BY(1), 1) = " ": BY(1) = BY(1) - 1: MID$(a$(BX(1)), BY(1), 1) = "z": BD(1) = 2: GOTO PASSMOVE
        IF D$ = " " THEN MID$(a$(BX(1)), BY(1), 1) = " ": BX(1) = BX(1) - 1: MID$(a$(BX(1)), BY(1), 1) = "z": BD(1) = 1: GOTO PASSMOVE
        BD(1) = 4

    CASE 3 'DOWN
        B$ = MID$(a$(BX(1) + 1), BY(1), 1)
        C$ = MID$(a$(BX(1)), BY(1) + 1, 1)
        D$ = MID$(a$(BX(1)), BY(1) - 1, 1)
        IF C$ = " " THEN MID$(a$(BX(1)), BY(1), 1) = " ": BY(1) = BY(1) + 1: MID$(a$(BX(1)), BY(1), 1) = "z": BD(1) = 4: GOTO PASSMOVE
        IF B$ = " " THEN MID$(a$(BX(1)), BY(1), 1) = " ": BX(1) = BX(1) + 1: MID$(a$(BX(1)), BY(1), 1) = "z": BD(1) = 3: GOTO PASSMOVE
        IF D$ = " " THEN MID$(a$(BX(1)), BY(1), 1) = " ": BY(1) = BY(1) - 1: MID$(a$(BX(1)), BY(1), 1) = "z": BD(1) = 2: GOTO PASSMOVE
        BD(1) = 1

    CASE 4 'RIGHT
        B$ = MID$(a$(BX(1)), BY(1) + 1, 1)
        C$ = MID$(a$(BX(1) - 1), BY(1), 1)
        D$ = MID$(a$(BX(1) + 1), BY(1), 1)
        IF C$ = " " THEN MID$(a$(BX(1)), BY(1), 1) = " ": BX(1) = BX(1) - 1: MID$(a$(BX(1)), BY(1), 1) = "z": BD(1) = 1: GOTO PASSMOVE
        IF B$ = " " THEN MID$(a$(BX(1)), BY(1), 1) = " ": BY(1) = BY(1) + 1: MID$(a$(BX(1)), BY(1), 1) = "z": BD(1) = 4: GOTO PASSMOVE
        IF D$ = " " THEN MID$(a$(BX(1)), BY(1), 1) = " ": BX(1) = BX(1) + 1: MID$(a$(BX(1)), BY(1), 1) = "z": BD(1) = 3: GOTO PASSMOVE
        BD(1) = 2

        PASSMOVE:
END SELECT
RETURN
FPS:
COLOR 4, 0
FOR J = 1 TO 9
    FOR I = 1 TO 20
        B$ = MID$(a$(J), I, 1)
        SCREENMEM%(I, J) = VAL(B$)
        LOCATE J, I: PRINT B$
    NEXT I
NEXT J

COLOR 6
FOR I = 1 TO 9
    FOR J = 1 TO 20
        LOCATE I + 8, J + 10
        B$ = MID$(a$(I), J, 1)
        IF B$ = "w" THEN COLOR 6, 1: PRINT CHR$(WALL)
        IF B$ = "." THEN COLOR 14, 4: PRINT "°"
        IF B$ = "z" THEN COLOR 15, 0: PRINT CHR$(BUTTERFLY)
        IF B$ = " " THEN COLOR 0, 0: PRINT CHR$(SPACE)
    NEXT J
NEXT I
_DISPLAY
RETURN

this is my AI routine.. Not the smartest but works great.

14
thank you guys :) much appreciated.... still working on other routines also. but going great. stuck a snapshot on the work sofar.


15
hi below is my keyboard routine... it runs great but how can i run the same input without the keyboard repeat delay

i want to just press the keys and they will respond like a joystick... holding the key has a delay then repeat.
 
this is for my game i am making which so far feel really cool to play...

this is a remake of my digit (ASCII graphics boulder but written from complete scratch with multi color graphics and 8 frame animation.. just not ready yet to demo.. but is pretty cool


Code: QB64: [Select]
  1.    KH& = _KEYHIT: SHFT% = _KEYDOWN(100303) OR _KEYDOWN(100304): ESC% = _KEYDOWN(27)
  2.     IF KH& = -18432 THEN
  3.         Z% = SCREENMEM%(MJ% - 1, MI%)
  4.         IF Z% = DIRT THEN SCREENMEM%(MJ%, MI%) = SPACE: SCREENMEM%(MJ% - 1, MI%) = MAN: MJ% = MJ% - 1
  5.         IF Z% = SPACE THEN SCREENMEM%(MJ%, MI%) = SPACE: SCREENMEM%(MJ% - 1, MI%) = MAN: MJ% = MJ% - 1
  6.         IF Z% = DIAMOND THEN SCREENMEM%(MJ%, MI%) = SPACE: SCREENMEM%(MJ% - 1, MI%) = MAN: MJ% = MJ% - 1
  7.         'UP
  8.     END IF
  9.     IF KH& = -20480 THEN
  10.         Z% = SCREENMEM%(MJ% + 1, MI%)
  11.         IF Z% = DIRT THEN SCREENMEM%(MJ%, MI%) = SPACE: SCREENMEM%(MJ% + 1, MI%) = MAN: MJ% = MJ% + 1
  12.         IF Z% = SPACE THEN SCREENMEM%(MJ%, MI%) = SPACE: SCREENMEM%(MJ% + 1, MI%) = MAN: MJ% = MJ% + 1
  13.         IF Z% = DIAMOND THEN SCREENMEM%(MJ%, MI%) = SPACE: SCREENMEM%(MJ% + 1, MI%) = MAN: MJ% = MJ% + 1
  14.         'DOWN
  15.     END IF
  16.     IF KH& = -19200 AND SHFT% = -1 THEN
  17.         Z1% = SCREENMEM%(MJ%, MI% - 1)
  18.         Z2% = SCREENMEM%(MJ%, MI% + 1)
  19.         IF Z1% = DIRT AND Z2% = BOULDER THEN SCREENMEM%(MJ%, MI% - 1) = MAN: SCREENMEM%(MJ%, MI%) = BOULDER: SCREENMEM%(MJ%, MI% + 1) = SPACE: MI% = MI% - 1: GOTO NEXTM
  20.         IF Z1% = SPACE AND Z2% = BOULDER THEN SCREENMEM%(MJ%, MI% - 1) = MAN: SCREENMEM%(MJ%, MI%) = BOULDER: SCREENMEM%(MJ%, MI% + 1) = SPACE: MI% = MI% - 1: GOTO NEXTM
  21.         IF Z1% = SPACE AND Z2% = DIAMOND THEN SCREENMEM%(MJ%, MI% - 1) = MAN: SCREENMEM%(MJ%, MI%) = DIAMOND: SCREENMEM%(MJ%, MI% + 1) = SPACE: MI% = MI% - 1: GOTO NEXTM
  22.         GOTO NEXTM
  23.         'LEFT SHIFT
  24.     END IF
  25.     IF KH& = -19200 THEN
  26.         Z% = SCREENMEM%(MJ%, MI% - 1)
  27.         IF Z% = DIRT THEN SCREENMEM%(MJ%, MI%) = SPACE: SCREENMEM%(MJ%, MI% - 1) = MAN: MI% = MI% - 1
  28.         IF Z% = SPACE THEN SCREENMEM%(MJ%, MI%) = SPACE: SCREENMEM%(MJ%, MI% - 1) = MAN: MI% = MI% - 1: SCY1% = SCY1% - 1
  29.         IF Z% = DIAMOND THEN SCREENMEM%(MJ%, MI%) = SPACE: SCREENMEM%(MJ%, MI% - 1) = MAN: MI% = MI% - 1
  30.         IF Z% = BOULDER AND SCREENMEM%(MJ%, MI% - 2) = SPACE THEN SCREENMEM%(MJ%, MI% - 2) = BOULDER: SCREENMEM%(MJ%, MI% - 1) = MAN: SCREENMEM%(MJ%, MI%) = SPACE: MI% = MI% - 1
  31.         'LEFT
  32.     END IF
  33.     IF KH& = -19712 AND SHFT% = -1 THEN
  34.         Z1% = SCREENMEM%(MJ%, MI% + 1)
  35.         Z2% = SCREENMEM%(MJ%, MI% - 1)
  36.         IF Z1% = DIRT AND Z2% = BOULDER THEN SCREENMEM%(MJ%, MI% + 1) = MAN: SCREENMEM%(MJ%, MI%) = BOULDER: SCREENMEM%(MJ%, MI% - 1) = SPACE: MI% = MI% + 1: GOTO NEXTM
  37.         IF Z1% = SPACE AND Z2% = BOULDER THEN SCREENMEM%(MJ%, MI% + 1) = MAN: SCREENMEM%(MJ%, MI%) = BOULDER: SCREENMEM%(MJ%, MI% - 1) = SPACE: MI% = MI% + 1: GOTO NEXTM
  38.         IF Z1% = SPACE AND Z2% = DIAMOND THEN SCREENMEM%(MJ%, MI% + 1) = MAN: SCREENMEM%(MJ%, MI%) = DIAMOND: SCREENMEM%(MJ%, MI% - 1) = SPACE: MI% = MI% + 1: GOTO NEXTM
  39.         GOTO NEXTM
  40.         'RIGHT SHIFT
  41.     END IF
  42.  
  43.     IF KH& = -19712 THEN
  44.         Z% = SCREENMEM%(MJ%, MI% + 1)
  45.         IF Z% = DIRT THEN SCREENMEM%(MJ%, MI%) = SPACE: SCREENMEM%(MJ%, MI% + 1) = MAN: MI% = MI% + 1
  46.         IF Z% = SPACE THEN SCREENMEM%(MJ%, MI%) = SPACE: SCREENMEM%(MJ%, MI% + 1) = MAN: MI% = MI% + 1
  47.         IF Z% = DIAMOND THEN SCREENMEM%(MJ%, MI%) = SPACE: SCREENMEM%(MJ%, MI% + 1) = MAN: MI% = MI% + 1
  48.         IF Z% = BOULDER AND SCREENMEM%(MJ%, MI% + 2) = SPACE THEN SCREENMEM%(MJ%, MI% + 2) = BOULDER: SCREENMEM%(MJ%, MI% + 1) = MAN: SCREENMEM%(MJ%, MI%) = SPACE: MI% = MI% + 1
  49.         'RIGHT
  50.     END IF
  51.     NEXTM:
  52. LOOP UNTIL ESC% = -1

Pages: [1] 2 3 ... 13