Author Topic: SimpleWindow Game  (Read 4144 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
SimpleWindow Game
« on: April 13, 2013, 01:02:04 PM »
Deleted
« Last Edit: April 25, 2015, 05:01:30 AM by Peter »

JRS

  • Guest
Re: SimpleWindow Game
« Reply #1 on: April 13, 2013, 02:12:50 PM »
Peter,

Rene on the thinBasic forum says that I'm the only person able to make SB work. I have converted a number of your games and animated graphics examples to SB using DLLC without issue. Any chance you could convert this game to SB and prove Rene wrong? It would also give you a chance to do your first game in SB and give a review of the process and SB as a language. Don't hold back and call it as you see it.

FYI The latest DLLC works with scribaw. (no console / manifest support)

John

JRS

  • Guest
Re: SimpleWindow Game
« Reply #2 on: April 13, 2013, 09:18:01 PM »
Quote
FYI The latest DLLC works with scribaw. (no console / manifest support)

Well, at least with IUP.

As soon as I press enter at the startup screen of SokoMouse, I get a GPF using scribaw.exe Please continue to use scriba.exe with Simple Window. (sw.dll)

P.S.

I using the latest dllc.dll, oxygen.dll and sw.dll versions and unable to get the non-console mode version of Scriptbasic to work with Simple Window.

« Last Edit: April 13, 2013, 09:28:12 PM by JRS »

Aurel

  • Guest
Re: SimpleWindow Game
« Reply #3 on: April 13, 2013, 11:09:05 PM »
Quote
unable to get the non-console mode version of Scriptbasic to work with Simple Window.
Yes John ...why is that ?When you compile SB on windows why you simply 'turn off' console mode
in your C compiler( gcc in CodeBlocks for example have this switch-
i know this because i have compile Yabasic with this IDE )

However this time Peter game work fine, one point more to GDI vs openGL. ;D

By the way is funny & cool to see good old John in action + fight soap opera with Rene.
Fight John..fight... ;D
« Last Edit: April 13, 2013, 11:14:26 PM by Aurel »

JRS

  • Guest
Re: SimpleWindow Game
« Reply #4 on: April 14, 2013, 12:11:11 AM »
Quote
However this time Peter game work fine, one point more to GDI vs openGL.

Which game?
O2 or SB version?

Keep in mind that Simple Window is being dynamically scripted at runtime via DLLC. (FFI) Charles has gone beyond the standard FFI interface and providing the same access to structures and pointers that are traditionally reserved for compiled applications. I'm sure Charles will figure out the scribaw issue just like he did for IUP.


JRS

  • Guest
Re: SimpleWindow Game
« Reply #5 on: April 14, 2013, 01:06:43 AM »
I'm just having a little fun with the clown. I love it when wide eyed beginners think everything done before them is sh*t and they have all the answers. I'm sure Eros is going to close the thread anyways an put a stop to the noise.


Aurel

  • Guest
Re: SimpleWindow Game
« Reply #6 on: April 14, 2013, 07:11:32 AM »
I understand that openGL have more advanced features,and probably you
have a right , but for me GDi is just fine.

Peter
Do you ever do some things with DirectX ?

Charles Pegge

  • Guest
Re: SimpleWindow Game
« Reply #7 on: April 14, 2013, 07:12:43 AM »
In the Opengl Woods, you have to follow the bears.


JRS

  • Guest
Re: SimpleWindow Game
« Reply #8 on: April 14, 2013, 07:18:56 AM »
Quote
Game translation to ScriptBasic is too much work.

Actually its not.

  • I plan on converting your binary map files as there are too many refrerences to the map arrays to use ASC(map[location]) like I did in SokoMouse.
  • All variables in SB are static or global unless you declare them as LOCAL.
  • It would make these games easier to port if you would not exclude the optional THEN as its not optional in SB.
  • Convert variable declares to an initial state assignments.

I'll try and get the game converted when I have a few extra minutes.

Thanks for trying, Rene may be right.  :-\

Aurel

  • Guest
Re: SimpleWindow Game
« Reply #9 on: April 14, 2013, 10:25:08 AM »
peter
if you don't know what with openGL wood look this....hehe


X

Aurel

  • Guest
Re: SimpleWindow Game
« Reply #10 on: April 14, 2013, 11:29:39 AM »
Yo dude...
Sometimes when i have times i like to draw.
hmmm i was just thinking about your game ..maybe will be good to change small boy to
bear  :D

JRS

  • Guest
Re: SimpleWindow Game
« Reply #11 on: April 14, 2013, 04:47:51 PM »


Code: [Select]
' A Game by PETER WIRBELAUER

INCLUDE "sbsw.inc"

' Game Routines
SUB BoyBumm
  LOCAL vExp
  IF yExp > 0 THEN
    SW_Sprite s9, xExp, yExp, zExp
    IF play = 0 THEN
      SW_PlayWav w4
      play = 1
    END IF
    vExp += .2
    IF vExp >= 1 THEN
      vExp = 0
      zExp += 1
      IF zExp = 16 THEN
        yExp = 0
       iExp = 1
      END IF
    END IF
  END IF
END SUB

SUB InitEny
  P = 0
  FOR y = 0 TO 29
    FOR x = 0 TO 39
      z = y * 40 + x
      IF map3[z] = 62 THEN
        xEny[p] = x * 64
        yEny[p] = y * 64
        rEny[p] =- 1
        p += 1
      ELSE IF map3[z] = 63 THEN
        xEny[p] = x * 64
        yEny[p] = y * 64
        rEny[p] =- 1
        p += 1
      ELSE IF map3[z] = 64 THEN
        xEny[p] = x * 64
        yEny[p] = y * 64
        rEny[p] = -1
        p += 1
      ELSE IF map3[z] = 65 THEN
        xEny[p] = x * 64
        yEny[p] = y * 64
        rEny[p] = -1
        p += 1
      END IF
      IF p = 4 THEN EXIT SUB
    NEXT
  NEXT
END SUB

SUB ScanEnemy
  IF eras > 0 THEN EXIT SUB
    FOR x = 0 TO 3
      z = (yEny[x] * 40 + xEny[x]) / 64
      IF map3[z] = 62 AND map3[z+1] = 111 THEN
        map3[z] = 32
        map3[z + 1] = 62
        rEny[x] = 1
      ELSE IF map3[z] = 63 AND map3[z - 1] = 111 THEN
        map3[z] = 32
        map3[z - 1] = 63
        rEny[x]=2
      ELSE IF map3[z] = 64 AND map3[z - 40] = 111 THEN
        map3[z] = 32
        map3[z - 40] = 64
        rEny[x] = 3
      ELSE IF map3[z] = 65 AND map3[z + 40] = 111 THEN
        map3[z] = 32
        map3[z + 40] = 65
        rEny[x]=4
      ELSE IF (map3[z] = 62 AND map3[z + 40] = 111) OR (map3[z] = 63 AND map3[z + 40] = 111) THEN
        map3[z] = 32
        map3[z + 40] = 65
        rEny[x] = 4
      ELSE IF (map3[z] = 62 AND map3[z - 40] = 111) OR (map3[z] = 63 AND map3[z - 40] = 111) THEN
        map3[z] = 32
        map3[z - 40] = 64
        rEny[x] = 3
      ELSE IF (map3[z] = 64 AND map3[z - 1] = 111) OR (map3[z] = 65 AND map3[z - 1] = 111) THEN
        map3[z] = 32
        map3[z - 1] = 63
        rEny[x] = 2
      ELSE IF (map3[z] = 64 AND map3[z + 1] = 111) OR (map3[z] = 65 AND map3[z + 1] = 111) THEN
        map3[z] = 32
        map3[z + 1] = 62
        rEny[x] = 1
      ELSE IF map3[z] = 62 THEN
        IF map1[z]=105 AND map3[z + 1] = 32 AND map3[z + 40] = 32 THEN
          rx = SW_Rnd(1, 2)
          IF rx = 1 THEN
            rEny[x] = 1
            map3[z] = 32
            map3[z + 1] = 62
          ELSE IF rx = 2 THEN
            rEny[x] = 4
            map3[z] = 32
            map3[z + 40] = 65
          END IF
        ELSE IF map1[z] = 105 AND map3[z + 1] = 32 AND map3[z - 40] = 32 THEN
          rx = SW_Rnd(1, 2)
          IF rx = 1 THEN
            rEny[x] = 1
            map3[z] = 32
            map3[z + 1] = 62
          ELSE IF rx = 2 THEN
            rEny[x] = 3
            map3[z] = 32
            map3[z - 40] = 64
          END IF
        ELSE IF map1[z] = 105 AND map3[z + 40] = 32 AND map3[z - 40] = 32 THEN
          rx = SW_Rnd(1, 2)
          IF rx = 1 THEN
            rEny[x] = 4
            map3[z] = 32
            map3[z + 40] = 64
          ELSE IF rx = 2 THEN
            rEny[x] = 3
            map3[z] = 32
            map3[z - 40] = 64
          END IF
        ELSE IF map3[z + 40] = 32 AND map3[z + 1] > 32 THEN
          map3[z] = 32
          map3[z + 40] = 65
          rEny[x] = 4
        ELSE IF map3[z - 40] = 32 AND map3[z + 1] > 32 THEN
          map3[z] = 32
          map3[z - 40] = 64
          rEny[x] = 3
        ELSE IF map3[z + 1] > 32 AND map3[z + 40] > 32 AND map3[z - 40] > 32 AND map3[z - 1] = 32 THEN
          map3[z] = 32
          map3[z - 1] = 63
          rEny[x] = 2
        ELSE IF map3[z + 1] > 32 AND map3[z + 40] > 32 AND map3[z - 40] > 32 THEN
          rEny[x] = -1
        ELSE IF map3[z] = 62 AND map3[z + 1] = 32 THEN
          map3[z] = 32
          map3[z + 1] = 62
          rEny[x] = 1
        END IF
      ELSE IF map3[z] = 63 THEN
      IF map1[z] = 105 AND map3[z - 1] = 32 AND map3[z - 40] = 32 THEN
        rx = SW_Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 2
          map3[z] = 32
          map3[z - 1] = 63
        ELSE IF rx = 2 THEN
          rEny[x] = 3
          map3[z] = 32
          map3[z - 40] = 64
        END IF
      ELSE IF map1[z] = 105 AND map3[z + 40] = 32 AND map3[z - 40] = 32 THEN
          rx = SW_Rnd(1, 2)
          IF rx = 1 THEN
            rEny[x] = 4
            map3[z] = 32
            map3[z + 40] = 64
          ELSE IF rx = 2 THEN
            rEny[x] = 3
            map3[z] = 32
            map3[z - 40] = 64
          END IF
      ELSE IF map1[z] = 105 AND map3[z - 1] = 32 AND map3[z + 40] = 32 THEN
        rx = SW_Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 2
          map3[z] = 32
          map3[z - 1] = 63
        ELSE IF rx = 2 THEN
          rEny[x] = 4
          map3[z] = 32
          map3[z + 40] = 65
        END IF
      ELSE IF map3[z + 40] = 32 AND map3[z - 1] > 32 THEN
        map3[z] = 32
        map3[z + 40] = 65
        rEny[x] = 4
      ELSE IF map3[z - 40] = 32 AND map3[z - 1] > 32 THEN
        map3[z] = 32
        map3[z - 40] = 64
        rEny[x] = 3
      ELSE IF map3[z - 1] > 32 AND map3[z + 40] > 32 AND map3[z - 40] > 32 AND map3[z + 1] = 32 THEN
        map3[z] = 32
        map3[z + 1] = 62
        rEny[x] = 1
      ELSE IF map3[z - 1] > 32 AND map3[z + 40] > 32 AND map3[z - 40] > 32 THEN
        rEny[x] = -1
      ELSE IF map3[z] = 63 AND map3[z - 1] = 32 THEN
        map3[z] = 32
        map3[z - 1] = 63
        rEny[x] = 2
      END IF
    ELSE IF map3[z] = 64 THEN
      IF map1[z] = 105 AND map3[z - 40] = 32 AND map3[z + 1] = 32 THEN
        rx = SW_Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 3
          map3[z] = 32
          map3[z - 40] = 64
        ELSE IF rx = 2 THEN
          rEny[x] = 1
          map3[z] = 32
          map3[z + 1] = 62
        END IF
      ELSE IF map1[z] = 105 AND map3[z - 40] = 32 AND map3[z - 1] = 32 THEN
        rx = SW_Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 3
          map3[z] = 32
          map3[z - 40] = 64
        ELSE IF rx = 2 THEN
          rEny[x] = 2
          map3[z] = 32
          map3[z - 1] = 63
        END IF
      ELSE IF map1[z] = 105 AND map3[z - 1] = 32 AND map3[z + 1] = 32 THEN
        rx = SW_Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 1
          map3[z] = 32
          map3[z + 1] = 62
        ELSE IF rx = 2 THEN
          rEny[x] = 2
          map3[z] = 32
          map3[z - 1] = 63
        END IF
      ELSE IF map3[z - 40] > 32 AND map3[z - 1] = 32 THEN
        map3[z] = 32
        map3[z - 1] = 63
        rEny[x] = 2
      ELSE IF map3[z - 40] > 32 AND map3[z + 1] = 32 THEN
        map3[z] = 32
        map3[z + 1] = 62
        rEny[x] = 1
      ELSE IF map3[z - 40] > 32 AND map3[z + 1] > 32 AND map3[z - 1] > 32 AND map3[z + 40] = 32 THEN
        map3[z] = 32
        map3[z + 40] = 65
        rEny[x] = 4
      ELSE IF map3[z - 40] > 32 AND map3[z + 1] > 32 AND map3[z - 1] > 32 THEN
        rEny[x] = -1
      ELSE IF map3[z] = 64 AND map3[z - 40] = 32 THEN
        map3[z] = 32
        map3[z - 40] = 64
        rEny[x] = 3
      ELSE
        rEny[x] = -1
      END IF
    ELSE IF map3[z] = 65 THEN
      IF map1[z] = 105 AND map3[z + 40] = 32 AND map3[z + 1] = 32 THEN
        rx= SW_Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 4
          map3[z] = 32
          map3[z + 40] = 65
        ELSE IF rx = 2 THEN
          rEny[x] = 1
          map3[z] = 32
          map3[z + 1] = 62
        END IF
      ELSE IF map1[z] = 105 AND map3[z + 40] = 32 AND map3[z - 1] = 32 THEN
        rx = SW_Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 4
          map3[z] = 32
          map3[z + 40] = 65
        ELSE IF rx = 2 THEN
          rEny[x] = 2
          map3[z] = 32
          map3[z - 1] = 63
        END IF
      ELSE IF map1[z] = 105 AND map3[z + 1] = 32 AND map3[z - 1] = 32 THEN
        rx = SW_Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 1
          map3[z] = 32
          map3[z + 1] = 62
        ELSE IF rx = 2 THEN
          rEny[x] = 2
          map3[z]=32
          map3[z-1]=63
        END IF
      ELSE IF map3[z + 40] > 32 AND map3[z - 1] = 32 THEN
        map3[z] = 32
        map3[z - 1] = 63
        rEny[x] = 2
      ELSE IF map3[z + 40] > 32 AND map3[z + 1] = 32 THEN
        map3[z] = 32
        map3[z + 1] = 62
        rEny[x] = 1
      ELSE IF map3[z + 40] > 32 AND map3[z + 1] > 32 AND map3[z - 1] > 32 AND map3[z -40] = 32 THEN
        map3[z] = 32
        map3[z - 40] = 64
        rEny[x] = 3
      ELSE IF map3[z + 40] > 32 AND map3[z + 1] > 32 AND map3[z - 1] > 32 THEN
        rEny[x] = -1
      ELSE IF map3[z + 40] = 32 THEN
        map3[z] = 32
        map3[z + 40] = 65
        rEny[x] = 4
      END IF
    END IF
  NEXT
END SUB

SUB SetEny(e)
  vEny[e] += .2
  IF vEny[e] >= 1 THEN
    vEny[e] = 0
    zEny[e] += 1
    IF zEny[e] = 16 THEN zEny[e] = 0
  END IF
END SUB

SUB ShowEnemy
  FOR z = 0 TO 3
    IF rEny[z] = -1 THEN
      SW_Sprite(sc, xEny[z], yEny[z], zEny[z])
      SetEny(z)
    ELSE IF rEny[z] = 1 THEN
      xEny[z] += 1
      SW_Sprite(sc, xEny[z], yEny[z], zEny[z])
      SetEny(z)
    ELSE IF rEny[z] = 2 THEN
      xEny[z] -= 1
      SW_Sprite(sc, xEny[z], yEny[z], zEny[z])
      SetEny(z)
    ELSE IF rEny[z] = 3 THEN
      yEny[z] -= 1
      SW_Sprite(sc, xEny[z], yEny[z], zEny[z])
      SetEny(z)
    ELSE IF rEny[z] = 4 THEN
      yEny[z] += 1
      SW_Sprite(sc, xEny[z], yEny[z], zEny[z])
      SetEny(z)
    END IF
  NEXT
  eras += 1
  IF eras = 64 THEN eras = 0
END SUB

SUB ShowMaps
  LOCAL vAtom
  FOR y = 0 TO 29
    FOR x = 0 TO 39
      z = y * 40 + x
      IF map1[z] = 34 THEN SW_Sprite(s1, x * 64, y * 64, 1)
      IF map1[z] = 107 THEN SW_Sprite(s1, x * 64, y * 64, 2)
      IF map1[z] = 105 THEN SW_Sprite(s1, x * 64, y * 64, 2)
      IF map2[z] = 91 THEN SW_Sprite(s2, x * 64, y * 64, zAtom)
      IF map2[z] = 121 THEN SW_Sprite(s7, x * 64, y * 64, 0)
      IF map2[z] = 81 THEN SW_Sprite(sa, x * 64, y * 64, zAtom)
    NEXT
  NEXT
  vAtom += .2
  IF vAtom >= 1 THEN
    vAtom = 0
    zAtom += 1
    IF zAtom = 16 THEN zAtom = 0
  END IF
END SUB

SUB InitBoy
  FOR y = 0 TO 29
    FOR x = 0 TO 39
      z = y * 40 + x
      IF map3[z] = 111 THEN
        xBoy = x * 64
        yBoy = y * 64
      END IF
      IF map2[z] = 91 OR map2[z] = 81 THEN
        pills += 1
      END IF
      IF map2[z] = 121 THEN
        xExit = x * 64
        yExit = y * 64
      END IF
    NEXT
  NEXT
END SUB

SUB CheckBoy
  IF ras > 0 OR rBoy >= 5 THEN EXIT SUB
  z = (yBoy * 40 + xBoy) / 64
  IF map3[z] >= 62 AND map3[z] <= 65 THEN
    rBoy = 6
    xExp = xBoy
    yExp = yBoy
  ELSE IF map2[z] = 121 AND aExit = 1 THEN
    xShrink = xBoy
    yShrink = yBoy
    map3[z] = 32
    rBoy = 5
  ELSE IF map2[z] = 91 THEN
    xPill = xBoy
    yPill = yBoy
    Pills -= 1
    map2[z] = 32
    map3[z] = 32
    rBoy = 0
    SW_PlayWav w2
  ELSE IF map2[z] = 81 THEN
    xStar = xBoy
    yStar = yBoy
    Pills -= 1
    map2[z] = 32
    map3[z] = 32
    rBoy = 0
    SW_PlayWav w5
  ELSE IF SW_Key(39) < 0 AND map3[z + 1] = 32 THEN
    map3[z] = 32
    map3[z + 1] = 111
    rBoy = 1
  ELSE IF SW_Key(37) < 0 AND map3[z - 1] = 32 THEN
    map3[z] = 32
    map3[z - 1] = 111
    rBoy = 2
  ELSE IF SW_Key(38) < 0 AND map3[z - 40] = 32 THEN
    map3[z] = 32
    map3[z - 40] = 111
    rBoy = 3
  ELSE IF SW_Key(40) < 0 AND map3[z + 40] = 32 THEN
    map3[z] = 32
    map3[z + 40] = 111
    rBoy = 4
  ELSE
    rBoy = 0
  END IF
END SUB

SUB DrawBoy
  LOCAL vBoy
  IF rBoy = 0 THEN
    SW_Sprite s3, xBoy, yBoy, 0
  ELSE IF rBoy = 1 THEN
    xBoy += 1
    SW_Sprite s5,xBoy,yBoy,zBoy
    vBoy += .2
    IF vBoy >= 1 THEN
      vBoy = 0
      zBoy += 1
      IF zBoy = 16 THEN zBoy = 0
    END IF
    ras += 1
    IF ras = 64 THEN ras = 0
  ELSE IF rBoy = 2 THEN
    xBoy -= 1
    SW_Sprite s6, xBoy, yBoy, zBoy
    vBoy += .2
    IF vBoy >= 1 THEN
      vBoy = 0
      zBoy += 1
      IF zBoy = 16 THEN zBoy = 0
    END IF
    ras += 1
    IF ras = 64 THEN ras = 0
  ELSE IF rBoy = 3 THEN
    yBoy -= 1
    SW_Sprite s4, xBoy, yBoy, zBoy
    vBoy += .2
    IF vBoy >= 1 THEN
      vBoy = 0
      zBoy += 1
      IF zBoy = 16 THEN zBoy = 0
    END IF
    ras += 1
    IF ras = 64 THEN ras = 0
  ELSE IF rBoy = 4 THEN
    yBoy +=1
    SW_Sprite s3, xBoy, yBoy, zBoy
    vBoy += .2
    IF vBoy >= 1 THEN
      vBoy = 0
      zBoy += 1
      IF zBoy = 16 THEN zBoy = 0
    END IF
    ras += 1
    IF ras = 64 THEN ras = 0
  END IF
END SUB

SUB PillsAni
  LOCAL vPill
  IF ypill > 0 THEN
    SW_Sprite s8, xpill, yPill, zPill
    vPill += .2
    IF vPill >= 1 THEN
      vPill = 0
      zPill += 1
      IF zPill = 8 THEN
        zPill = 0
        yPill = 0
      END IF
    END IF
  END IF
END SUB

SUB NoPills
  IF Pills = 0 THEN
    IF pills = 0 AND aExit = 0 THEN SW_PlayWav(w1)
    aExit = 1
  END IF
END SUB

SUB ExitActiv
  LOCAL vExit
  IF aExit = 1 THEN
    SW_Sprite s7, xExit, yExit, zExit
    vExit += .2
    IF vExit >= 1 THEN
      vExit = 0
      zExit += 1
      IF zExit = 16 THEN zExit=0
    END IF
  END IF
END SUB

SUB BoyShrink
  LOCAL vShrink
  IF yShrink > 0 THEN
    SW_Sprite s9, xShrink, yShrink, zShrink
    vShrink +=.2
    IF vShrink >= 1 THEN
      vShrink = 0
      zShrink += 1
      IF zShrink = 16 THEN
        yShrink = 0
        SW_PlayWav w4
      END IF
    END IF
  END IF
END SUB

SUB StarShrink
  LOCAL vStar
  IF yStar > 0 THEN
    SW_Sprite sb, xStar, yStar, zStar
    vStar += .4
    IF vStar >= 1 THEN
      vStar=0
      zStar += 1
      IF zStar = 16 THEN
        zStar = 0
        yStar = 0
        vStar = 0
      END IF
    END IF
  END IF
END SUB

SUB InitDat
  FOR x = 0 TO 4
    xEny[x] = 0
    yEny[x] = 0
    rEny[x] = 0
    zEny[x] = 0
    vEny[x] = 0
  NEXT
  xBoy = 0
  yBoy = 0
  zBoy = 0
  rBoy = 0
  xExit = 0
  yExit = 0
  zExit = 0
  aExit = 0
  xShrink = 0
  yShrink = 0
  zShrink = 0
  ras = 0
  pills = 0
  yPill = 0
  xPill = 0
  zPill = 0
  x = 0
  y = 0
  z = 0
  p = 0
  rx = 0
  zAtom = 0
  yStar = 0
  xStar = 0
  zStar=0
  xExp = 0
  yExp = 0
  zExp = 0
  iExp = 0
  eras = 0
  play = 0
END SUB

SUB NewGame
    SW_LoadBytes("maps/map" & m & "-1.txt",map1)
    SW_LoadBytes("maps/map" & m & "-2.txt",map2)
    SW_LoadBytes("maps/map" & m & "-3.txt",map3)
    InitDat
    InitEny
    InitBoy
END SUB


' Main

SW_Window 768,708,1
' Load Bitmaps
s1 = SW_LoadBmp("gfx/char.bmp", 60)
s2 = SW_LoadBmp("gfx/atom.bmp", 16)
s3 = SW_LoadBmp("gfx/boyd.bmp", 16)
s4 = SW_LoadBmp("gfx/boyu.bmp", 16)
s5 = SW_LoadBmp("gfx/boyr.bmp", 16)
s6 = SW_LoadBmp("gfx/boyl.bmp", 16)
s7 = SW_LoadBmp("gfx/exitani.bmp", 16)
s8 = SW_LoadBmp("gfx/pillani.bmp", 16)
s9 = SW_LoadBmp("gfx/bummani.bmp", 16)
sa = SW_LoadBmp("gfx/starani.bmp", 16)
sb = SW_LoadBmp("gfx/shrani.bmp", 16)
sc = SW_LoadBmp("gfx/fire.bmp", 16)

' Assign Sound Files
w1 = "gfx/success.wav"
w2 = "gfx/caim.wav"
w3 = "gfx/drown.wav"
w4 = "gfx/hit.wav"
w5 = "gfx/grab.wav"

'loadmaps
m = 1
SW_LoadBytes("maps/map" & m & "-1.txt",map1)
SW_LoadBytes("maps/map" & m & "-2.txt",map2)
SW_LoadBytes("maps/map" & m & "-3.txt",map3)
InitDat
InitEny
InitBoy
SW_SetFps(140)

WHILE SW_Key(27) = 0
  SW_SetCaption "PILLS: " & pills & "    MAP " & m
  IF SW_GetKey() = 32 THEN NewGame()
  IF SW_GetKey() = 110 AND rBoy = 5 THEN
    m += 1
    IF m = 12 THEN m = 1
    NewGame
  END IF
  ShowMaps
  ExitActiv
  BoyShrink
  BoyBumm
  ScanEnemy
  ShowEnemy
  CheckBoy
  DrawBoy
  PillsAni
  NoPills
  Starshrink
  IF rBoy = 5 THEN
    SW_BmpText s1, 140, 340, "NEXT MAP PRESS N", 32, 64
  END IF
  IF rBoy = 6 THEN
    SW_BmpText s1, 140, 340, "YOU WERE NABBED", 32, 64
  END IF
  SW_Redraw
WEND
SW_Quit()

For those interested in converting Peter's OxygenBasic examples/games to ScriptBasic, the process is rather simple. Other than a couple minor changes O2 code is compatible to SB.

  • Remove all variable and array declares - not required
  • Insert missing THEN statements
  • Replace STATIC with LOCAL in SUBs when variables require local scope
  • Replace + with & for string concatenation
  • Prefix Peter's Simple Window functions with SW_
  • Replace INCLUDE "sw.inc" with INCLUDE "sbsw.inc"



X
« Last Edit: April 14, 2013, 07:50:03 PM by JRS »

JRS

  • Guest
Re: SimpleWindow Game
« Reply #12 on: April 14, 2013, 06:08:29 PM »
Peter,

To show SB compatibility with O2, I took the converted game to SB and tried to make that code run under O2. Other than a few minor changes the code compiles and almost runs. I'm getting a Bass_StreamPlay error dialog which seems to be the only problem. Can you see if you can get the following code to work under O2? I'm getting the same error with Bass using the stock O2 version.

BTW: I had to declare a couple of variables you forgot and I'm surprise it compiled at all with the missing + operators to concatenate the remaining part of the map file names.

Missing variable declares: sc w5
Missing + operator LoadBytes("maps/map" + m "-1.txt",map1)

Code: [Select]
' A Game by PETER WIRBELAUER

' <START O2>
include "sw.inc"
include "bass.inc"
indexbase 0

InitBass

'variables
sys xBoy,yBoy,zBoy,rBoy,xExit,yExit,zExit,aExit,xShrink,yShrink,zShrink,play
sys ras,pills,yPill,xPill,zPill,x,y,z,p,rx,zAtom,yStar,xStar,zStar,eras
sys xExp,yExp,zExp,iExp,s1,s2,s3,s4,s5,s6,s7,s8,s9,sa,sb,sc,w1,w2,w3,w4,w5,m=1

Byte map1[1200]
Byte map2[1200]
Byte map3[1200]

sys xEny[4]
sys yEny[4]
sys rEny[4]
sys zEny[4]
single vEny[4]
' <END O2>

' Game Routines
SUB BoyBumm
  static single vExp
  IF yExp > 0 THEN
    Sprite s9, xExp, yExp, zExp
    IF play = 0 THEN
      PlaySound w4
      play = 1
    END IF
    vExp += .2
    IF vExp >= 1 THEN
      vExp = 0
      zExp += 1
      IF zExp = 16 THEN
        yExp = 0
       iExp = 1
      END IF
    END IF
  END IF
END SUB

SUB InitEny
  P = 0
  FOR y = 0 TO 29
    FOR x = 0 TO 39
      z = y * 40 + x
      IF map3[z] = 62 THEN
        xEny[p] = x * 64
        yEny[p] = y * 64
        rEny[p] =- 1
        p += 1
      ELSE IF map3[z] = 63 THEN
        xEny[p] = x * 64
        yEny[p] = y * 64
        rEny[p] =- 1
        p += 1
      ELSE IF map3[z] = 64 THEN
        xEny[p] = x * 64
        yEny[p] = y * 64
        rEny[p] = -1
        p += 1
      ELSE IF map3[z] = 65 THEN
        xEny[p] = x * 64
        yEny[p] = y * 64
        rEny[p] = -1
        p += 1
      END IF
      IF p = 4 THEN EXIT SUB
    NEXT
  NEXT
END SUB

SUB ScanEnemy
  IF eras > 0 THEN EXIT SUB
    FOR x = 0 TO 3
      z = (yEny[x] * 40 + xEny[x]) / 64
      IF map3[z] = 62 AND map3[z+1] = 111 THEN
        map3[z] = 32
        map3[z + 1] = 62
        rEny[x] = 1
      ELSE IF map3[z] = 63 AND map3[z - 1] = 111 THEN
        map3[z] = 32
        map3[z - 1] = 63
        rEny[x]=2
      ELSE IF map3[z] = 64 AND map3[z - 40] = 111 THEN
        map3[z] = 32
        map3[z - 40] = 64
        rEny[x] = 3
      ELSE IF map3[z] = 65 AND map3[z + 40] = 111 THEN
        map3[z] = 32
        map3[z + 40] = 65
        rEny[x]=4
      ELSE IF (map3[z] = 62 AND map3[z + 40] = 111) OR (map3[z] = 63 AND map3[z + 40] = 111) THEN
        map3[z] = 32
        map3[z + 40] = 65
        rEny[x] = 4
      ELSE IF (map3[z] = 62 AND map3[z - 40] = 111) OR (map3[z] = 63 AND map3[z - 40] = 111) THEN
        map3[z] = 32
        map3[z - 40] = 64
        rEny[x] = 3
      ELSE IF (map3[z] = 64 AND map3[z - 1] = 111) OR (map3[z] = 65 AND map3[z - 1] = 111) THEN
        map3[z] = 32
        map3[z - 1] = 63
        rEny[x] = 2
      ELSE IF (map3[z] = 64 AND map3[z + 1] = 111) OR (map3[z] = 65 AND map3[z + 1] = 111) THEN
        map3[z] = 32
        map3[z + 1] = 62
        rEny[x] = 1
      ELSE IF map3[z] = 62 THEN
        IF map1[z]=105 AND map3[z + 1] = 32 AND map3[z + 40] = 32 THEN
          rx = Rnd(1, 2)
          IF rx = 1 THEN
            rEny[x] = 1
            map3[z] = 32
            map3[z + 1] = 62
          ELSE IF rx = 2 THEN
            rEny[x] = 4
            map3[z] = 32
            map3[z + 40] = 65
          END IF
        ELSE IF map1[z] = 105 AND map3[z + 1] = 32 AND map3[z - 40] = 32 THEN
          rx = Rnd(1, 2)
          IF rx = 1 THEN
            rEny[x] = 1
            map3[z] = 32
            map3[z + 1] = 62
          ELSE IF rx = 2 THEN
            rEny[x] = 3
            map3[z] = 32
            map3[z - 40] = 64
          END IF
        ELSE IF map1[z] = 105 AND map3[z + 40] = 32 AND map3[z - 40] = 32 THEN
          rx = Rnd(1, 2)
          IF rx = 1 THEN
            rEny[x] = 4
            map3[z] = 32
            map3[z + 40] = 64
          ELSE IF rx = 2 THEN
            rEny[x] = 3
            map3[z] = 32
            map3[z - 40] = 64
          END IF
        ELSE IF map3[z + 40] = 32 AND map3[z + 1] > 32 THEN
          map3[z] = 32
          map3[z + 40] = 65
          rEny[x] = 4
        ELSE IF map3[z - 40] = 32 AND map3[z + 1] > 32 THEN
          map3[z] = 32
          map3[z - 40] = 64
          rEny[x] = 3
        ELSE IF map3[z + 1] > 32 AND map3[z + 40] > 32 AND map3[z - 40] > 32 AND map3[z - 1] = 32 THEN
          map3[z] = 32
          map3[z - 1] = 63
          rEny[x] = 2
        ELSE IF map3[z + 1] > 32 AND map3[z + 40] > 32 AND map3[z - 40] > 32 THEN
          rEny[x] = -1
        ELSE IF map3[z] = 62 AND map3[z + 1] = 32 THEN
          map3[z] = 32
          map3[z + 1] = 62
          rEny[x] = 1
        END IF
      ELSE IF map3[z] = 63 THEN
      IF map1[z] = 105 AND map3[z - 1] = 32 AND map3[z - 40] = 32 THEN
        rx = Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 2
          map3[z] = 32
          map3[z - 1] = 63
        ELSE IF rx = 2 THEN
          rEny[x] = 3
          map3[z] = 32
          map3[z - 40] = 64
        END IF
      ELSE IF map1[z] = 105 AND map3[z + 40] = 32 AND map3[z - 40] = 32 THEN
          rx = Rnd(1, 2)
          IF rx = 1 THEN
            rEny[x] = 4
            map3[z] = 32
            map3[z + 40] = 64
          ELSE IF rx = 2 THEN
            rEny[x] = 3
            map3[z] = 32
            map3[z - 40] = 64
          END IF
      ELSE IF map1[z] = 105 AND map3[z - 1] = 32 AND map3[z + 40] = 32 THEN
        rx = Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 2
          map3[z] = 32
          map3[z - 1] = 63
        ELSE IF rx = 2 THEN
          rEny[x] = 4
          map3[z] = 32
          map3[z + 40] = 65
        END IF
      ELSE IF map3[z + 40] = 32 AND map3[z - 1] > 32 THEN
        map3[z] = 32
        map3[z + 40] = 65
        rEny[x] = 4
      ELSE IF map3[z - 40] = 32 AND map3[z - 1] > 32 THEN
        map3[z] = 32
        map3[z - 40] = 64
        rEny[x] = 3
      ELSE IF map3[z - 1] > 32 AND map3[z + 40] > 32 AND map3[z - 40] > 32 AND map3[z + 1] = 32 THEN
        map3[z] = 32
        map3[z + 1] = 62
        rEny[x] = 1
      ELSE IF map3[z - 1] > 32 AND map3[z + 40] > 32 AND map3[z - 40] > 32 THEN
        rEny[x] = -1
      ELSE IF map3[z] = 63 AND map3[z - 1] = 32 THEN
        map3[z] = 32
        map3[z - 1] = 63
        rEny[x] = 2
      END IF
    ELSE IF map3[z] = 64 THEN
      IF map1[z] = 105 AND map3[z - 40] = 32 AND map3[z + 1] = 32 THEN
        rx = Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 3
          map3[z] = 32
          map3[z - 40] = 64
        ELSE IF rx = 2 THEN
          rEny[x] = 1
          map3[z] = 32
          map3[z + 1] = 62
        END IF
      ELSE IF map1[z] = 105 AND map3[z - 40] = 32 AND map3[z - 1] = 32 THEN
        rx = Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 3
          map3[z] = 32
          map3[z - 40] = 64
        ELSE IF rx = 2 THEN
          rEny[x] = 2
          map3[z] = 32
          map3[z - 1] = 63
        END IF
      ELSE IF map1[z] = 105 AND map3[z - 1] = 32 AND map3[z + 1] = 32 THEN
        rx = Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 1
          map3[z] = 32
          map3[z + 1] = 62
        ELSE IF rx = 2 THEN
          rEny[x] = 2
          map3[z] = 32
          map3[z - 1] = 63
        END IF
      ELSE IF map3[z - 40] > 32 AND map3[z - 1] = 32 THEN
        map3[z] = 32
        map3[z - 1] = 63
        rEny[x] = 2
      ELSE IF map3[z - 40] > 32 AND map3[z + 1] = 32 THEN
        map3[z] = 32
        map3[z + 1] = 62
        rEny[x] = 1
      ELSE IF map3[z - 40] > 32 AND map3[z + 1] > 32 AND map3[z - 1] > 32 AND map3[z + 40] = 32 THEN
        map3[z] = 32
        map3[z + 40] = 65
        rEny[x] = 4
      ELSE IF map3[z - 40] > 32 AND map3[z + 1] > 32 AND map3[z - 1] > 32 THEN
        rEny[x] = -1
      ELSE IF map3[z] = 64 AND map3[z - 40] = 32 THEN
        map3[z] = 32
        map3[z - 40] = 64
        rEny[x] = 3
      ELSE
        rEny[x] = -1
      END IF
    ELSE IF map3[z] = 65 THEN
      IF map1[z] = 105 AND map3[z + 40] = 32 AND map3[z + 1] = 32 THEN
        rx= Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 4
          map3[z] = 32
          map3[z + 40] = 65
        ELSE IF rx = 2 THEN
          rEny[x] = 1
          map3[z] = 32
          map3[z + 1] = 62
        END IF
      ELSE IF map1[z] = 105 AND map3[z + 40] = 32 AND map3[z - 1] = 32 THEN
        rx = Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 4
          map3[z] = 32
          map3[z + 40] = 65
        ELSE IF rx = 2 THEN
          rEny[x] = 2
          map3[z] = 32
          map3[z - 1] = 63
        END IF
      ELSE IF map1[z] = 105 AND map3[z + 1] = 32 AND map3[z - 1] = 32 THEN
        rx = Rnd(1, 2)
        IF rx = 1 THEN
          rEny[x] = 1
          map3[z] = 32
          map3[z + 1] = 62
        ELSE IF rx = 2 THEN
          rEny[x] = 2
          map3[z]=32
          map3[z-1]=63
        END IF
      ELSE IF map3[z + 40] > 32 AND map3[z - 1] = 32 THEN
        map3[z] = 32
        map3[z - 1] = 63
        rEny[x] = 2
      ELSE IF map3[z + 40] > 32 AND map3[z + 1] = 32 THEN
        map3[z] = 32
        map3[z + 1] = 62
        rEny[x] = 1
      ELSE IF map3[z + 40] > 32 AND map3[z + 1] > 32 AND map3[z - 1] > 32 AND map3[z -40] = 32 THEN
        map3[z] = 32
        map3[z - 40] = 64
        rEny[x] = 3
      ELSE IF map3[z + 40] > 32 AND map3[z + 1] > 32 AND map3[z - 1] > 32 THEN
        rEny[x] = -1
      ELSE IF map3[z + 40] = 32 THEN
        map3[z] = 32
        map3[z + 40] = 65
        rEny[x] = 4
      END IF
    END IF
  NEXT
END SUB

SUB SetEny(e)
  vEny[e] += .2
  IF vEny[e] >= 1 THEN
    vEny[e] = 0
    zEny[e] += 1
    IF zEny[e] = 16 THEN zEny[e] = 0
  END IF
END SUB

SUB ShowEnemy
  FOR z = 0 TO 3
    IF rEny[z] = -1 THEN
      Sprite(sc, xEny[z], yEny[z], zEny[z])
      SetEny(z)
    ELSE IF rEny[z] = 1 THEN
      xEny[z] += 1
      Sprite(sc, xEny[z], yEny[z], zEny[z])
      SetEny(z)
    ELSE IF rEny[z] = 2 THEN
      xEny[z] -= 1
      Sprite(sc, xEny[z], yEny[z], zEny[z])
      SetEny(z)
    ELSE IF rEny[z] = 3 THEN
      yEny[z] -= 1
      Sprite(sc, xEny[z], yEny[z], zEny[z])
      SetEny(z)
    ELSE IF rEny[z] = 4 THEN
      yEny[z] += 1
      Sprite(sc, xEny[z], yEny[z], zEny[z])
      SetEny(z)
    END IF
  NEXT
  eras += 1
  IF eras = 64 THEN eras = 0
END SUB

SUB ShowMaps
  static float vAtom
  FOR y = 0 TO 29
    FOR x = 0 TO 39
      z = y * 40 + x
      IF map1[z] = 34 THEN Sprite(s1, x * 64, y * 64, 1)
      IF map1[z] = 107 THEN Sprite(s1, x * 64, y * 64, 2)
      IF map1[z] = 105 THEN Sprite(s1, x * 64, y * 64, 2)
      IF map2[z] = 91 THEN Sprite(s2, x * 64, y * 64, zAtom)
      IF map2[z] = 121 THEN Sprite(s7, x * 64, y * 64, 0)
      IF map2[z] = 81 THEN Sprite(sa, x * 64, y * 64, zAtom)
    NEXT
  NEXT
  vAtom += .2
  IF vAtom >= 1 THEN
    vAtom = 0
    zAtom += 1
    IF zAtom = 16 THEN zAtom = 0
  END IF
END SUB

SUB InitBoy
  FOR y = 0 TO 29
    FOR x = 0 TO 39
      z = y * 40 + x
      IF map3[z] = 111 THEN
        xBoy = x * 64
        yBoy = y * 64
      END IF
      IF map2[z] = 91 OR map2[z] = 81 THEN
        pills += 1
      END IF
      IF map2[z] = 121 THEN
        xExit = x * 64
        yExit = y * 64
      END IF
    NEXT
  NEXT
END SUB

SUB CheckBoy
  IF ras > 0 OR rBoy >= 5 THEN EXIT SUB
  z = (yBoy * 40 + xBoy) / 64
  IF map3[z] >= 62 AND map3[z] <= 65 THEN
    rBoy = 6
    xExp = xBoy
    yExp = yBoy
  ELSE IF map2[z] = 121 AND aExit = 1 THEN
    xShrink = xBoy
    yShrink = yBoy
    map3[z] = 32
    rBoy = 5
  ELSE IF map2[z] = 91 THEN
    xPill = xBoy
    yPill = yBoy
    Pills -= 1
    map2[z] = 32
    map3[z] = 32
    rBoy = 0
    PlaySound w2
  ELSE IF map2[z] = 81 THEN
    xStar = xBoy
    yStar = yBoy
    Pills -= 1
    map2[z] = 32
    map3[z] = 32
    rBoy = 0
    PlaySound w5
  ELSE IF Key(39) < 0 AND map3[z + 1] = 32 THEN
    map3[z] = 32
    map3[z + 1] = 111
    rBoy = 1
  ELSE IF Key(37) < 0 AND map3[z - 1] = 32 THEN
    map3[z] = 32
    map3[z - 1] = 111
    rBoy = 2
  ELSE IF Key(38) < 0 AND map3[z - 40] = 32 THEN
    map3[z] = 32
    map3[z - 40] = 111
    rBoy = 3
  ELSE IF Key(40) < 0 AND map3[z + 40] = 32 THEN
    map3[z] = 32
    map3[z + 40] = 111
    rBoy = 4
  ELSE
    rBoy = 0
  END IF
END SUB

SUB DrawBoy
  LOCAL vBoy
  IF rBoy = 0 THEN
    Sprite s3, xBoy, yBoy, 0
  ELSE IF rBoy = 1 THEN
    xBoy += 1
    Sprite s5,xBoy,yBoy,zBoy
    vBoy += .2
    IF vBoy >= 1 THEN
      vBoy = 0
      zBoy += 1
      IF zBoy = 16 THEN zBoy = 0
    END IF
    ras += 1
    IF ras = 64 THEN ras = 0
  ELSE IF rBoy = 2 THEN
    xBoy -= 1
    Sprite s6, xBoy, yBoy, zBoy
    vBoy += .2
    IF vBoy >= 1 THEN
      vBoy = 0
      zBoy += 1
      IF zBoy = 16 THEN zBoy = 0
    END IF
    ras += 1
    IF ras = 64 THEN ras = 0
  ELSE IF rBoy = 3 THEN
    yBoy -= 1
    Sprite s4, xBoy, yBoy, zBoy
    vBoy += .2
    IF vBoy >= 1 THEN
      vBoy = 0
      zBoy += 1
      IF zBoy = 16 THEN zBoy = 0
    END IF
    ras += 1
    IF ras = 64 THEN ras = 0
  ELSE IF rBoy = 4 THEN
    yBoy +=1
    Sprite s3, xBoy, yBoy, zBoy
    vBoy += .2
    IF vBoy >= 1 THEN
      vBoy = 0
      zBoy += 1
      IF zBoy = 16 THEN zBoy = 0
    END IF
    ras += 1
    IF ras = 64 THEN ras = 0
  END IF
END SUB

SUB PillsAni
  static float vPill
  IF ypill > 0 THEN
    Sprite s8, xpill, yPill, zPill
    vPill += .2
    IF vPill >= 1 THEN
      vPill = 0
      zPill += 1
      IF zPill = 8 THEN
        zPill = 0
        yPill = 0
      END IF
    END IF
  END IF
END SUB

SUB NoPills
  IF Pills = 0 THEN
    IF pills = 0 AND aExit = 0 THEN PlaySound(w1)
    aExit = 1
  END IF
END SUB

SUB ExitActiv
  static float vExit
  IF aExit = 1 THEN
    Sprite s7, xExit, yExit, zExit
    vExit += .2
    IF vExit >= 1 THEN
      vExit = 0
      zExit += 1
      IF zExit = 16 THEN zExit=0
    END IF
  END IF
END SUB

SUB BoyShrink
  static float vShrink
  IF yShrink > 0 THEN
    Sprite s9, xShrink, yShrink, zShrink
    vShrink +=.2
    IF vShrink >= 1 THEN
      vShrink = 0
      zShrink += 1
      IF zShrink = 16 THEN
        yShrink = 0
        PlaySound w4
      END IF
    END IF
  END IF
END SUB

SUB StarShrink
  static float vStar
  IF yStar > 0 THEN
    Sprite sb, xStar, yStar, zStar
    vStar += .4
    IF vStar >= 1 THEN
      vStar=0
      zStar += 1
      IF zStar = 16 THEN
        zStar = 0
        yStar = 0
        vStar = 0
      END IF
    END IF
  END IF
END SUB

SUB InitDat
  FOR x = 0 TO 4
    xEny[x] = 0
    yEny[x] = 0
    rEny[x] = 0
    zEny[x] = 0
    vEny[x] = 0
  NEXT
  xBoy = 0
  yBoy = 0
  zBoy = 0
  rBoy = 0
  xExit = 0
  yExit = 0
  zExit = 0
  aExit = 0
  xShrink = 0
  yShrink = 0
  zShrink = 0
  ras = 0
  pills = 0
  yPill = 0
  xPill = 0
  zPill = 0
  x = 0
  y = 0
  z = 0
  p = 0
  rx = 0
  zAtom = 0
  yStar = 0
  xStar = 0
  zStar=0
  xExp = 0
  yExp = 0
  zExp = 0
  iExp = 0
  eras = 0
  play = 0
END SUB

SUB NewGame
    LoadBytes("maps/map" + m + "-1.txt",map1)
    LoadBytes("maps/map" + m + "-2.txt",map2)
    LoadBytes("maps/map" + m + "-3.txt",map3)
    InitDat
    InitEny
    InitBoy
END SUB


' Main

Window 768,708,1

' Load Bitmaps
s1 = LoadBmp("gfx/char.bmp", 60)
s2 = LoadBmp("gfx/atom.bmp", 16)
s3 = LoadBmp("gfx/boyd.bmp", 16)
s4 = LoadBmp("gfx/boyu.bmp", 16)
s5 = LoadBmp("gfx/boyr.bmp", 16)
s6 = LoadBmp("gfx/boyl.bmp", 16)
s7 = LoadBmp("gfx/exitani.bmp", 16)
s8 = LoadBmp("gfx/pillani.bmp", 16)
s9 = LoadBmp("gfx/bummani.bmp", 16)
sa = LoadBmp("gfx/starani.bmp", 16)
sb = LoadBmp("gfx/shrani.bmp", 16)
sc = LoadBmp("gfx/fire.bmp", 16)

' Assign Sound Files
w1= LoadSound "gfx/success.wav"
w2= LoadSound "gfx/caim.wav"
w3= LoadSound "gfx/drown.wav"
w4= LoadSound "gfx/hit.wav"
w5= LoadSound "gfx/grab.wav"

'loadmaps
m = 1
LoadBytes("maps/map" + m + "-1.txt",map1)
LoadBytes("maps/map" + m + "-2.txt",map2)
LoadBytes("maps/map" + m + "-3.txt",map3)
InitDat
InitEny
InitBoy
SetFps(140)

WHILE Key(27) = 0
  SetCaption "PILLS: " + pills + "    MAP " + m
  IF GetKey() = 32 THEN NewGame()
  IF GetKey() = 110 AND rBoy = 5 THEN
    m += 1
    IF m = 12 THEN m = 1
    NewGame
  END IF
  ShowMaps
  ExitActiv
  BoyShrink
  BoyBumm
  ScanEnemy
  ShowEnemy
  CheckBoy
  DrawBoy
  PillsAni
  NoPills
  Starshrink
  IF rBoy = 5 THEN
    BmpText s1, 140, 340, "NEXT MAP PRESS N", 32, 64
  END IF
  IF rBoy = 6 THEN
    BmpText s1, 140, 340, "YOU WERE NABBED", 32, 64
  END IF
  Redraw
WEND
Quit()
« Last Edit: April 15, 2013, 10:02:01 AM by JRS »

Charles Pegge

  • Guest
Re: SimpleWindow Game
« Reply #13 on: April 21, 2013, 03:40:22 AM »
The bears run the Khronos consortium. They are the only ones who know the way through the Opengl forest :)

JRS

  • Guest
Re: SimpleWindow Game
« Reply #14 on: April 21, 2013, 07:07:56 AM »
Charles,

Code: Text
  1.   static float vAtom
  2.  

TO

Code: [Select]
LOCAL float vAtom

Is there a way to use LOCAL and assign a type like STATIC?  That was the only thing I reverted to the original in the body of the game code.

Other than adding declares for variables and dimming arrays, The SB makeover of Peter's code runs in O2.

John