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 - B+

Pages: [1] 2 3 ... 29
1
Community news and announcements / Re: Game Competition
« on: 09. November 2017, 23:45:05 »
Hi John,

Here is reminder:
http://retrogamecoding.org/board/index.php?topic=382.0

I am using it on both Windows and Android but unfortunately very limited in Android because of my device (I think). The IDE is accessed from Right Mouse click in Windows and touching 3 very tiny vertical circles in lower right of Android screen when SmallBASIC is running, that's the part that does not work on my device, B&N NOOK but should be fine on modern phone.

It should work under Linux but I have no experience to share from that.

Again I remind folks, I am talking about "SmallBASIC" from Source Forge not "Small Basic" from MS.

2
Community news and announcements / Re: Game Competition
« on: 09. November 2017, 19:37:32 »
Hi Richey,

I have written several games, usually from classics but did invent one early on, Square Elimination which requires far too much thinking to be fun. Oh, there is eRATification which pretends to be a shooter game but is just an excuse to shoot a bunch of rats with plasma laser beams! I mean who cares about scores when you are about to be eaten alive by rats!

In fact currently I am working on Chess interface with QB64 but seriously considering testing the new JB version 2.0 beta finally released by Carl because JB has GUI I have practiced a little with.

With my games, if originally written in SmallBASIC, SdlBasic, JB, or now QB64, it is soon in the other flavors. The only exception is JB with slow graphics but solid GUI and unlimited Integers that Richard calls "arbitrary".

Can you name a game that requires unlimited Integers? I can, I call it Number Theory.

So Richey, does this information help you with your code writing?

PS Oh there was another shooter game with Plasma beam in space modified for excuse to try Escher tiling, it was a target practice thingy. I am sure I posted most all of them here or BP.org.

PPS Oh, here is another
http://retrogamecoding.org/board/index.php?topic=556.0
Thanks Rick3137 for idea! I still have Connect 4 on backburner, AI can spot and block a potential win or winning move but I want AI that makes smarter moves building both defense and offense.

3
Community news and announcements / Re: MasmBasic
« on: 09. November 2017, 19:19:37 »
Hi JJ,

Congratulations! How do you count it when macro name is same but has optional parameter, one or two?

4
Offtopic / Re: The good old days
« on: 05. November 2017, 18:04:01 »
I want what he's having!

5
Community news and announcements / Game Competition
« on: 04. November 2017, 15:16:39 »
Richey's post reminded me of this:
http://www.qb64.net/forum/index.php?topic=14570.0

Hosted by GitHub, another game coding competition that is not too late to submit (I think).

wait... do game coders come here?

6
Oh, it's over.

7
Code and examples / Re: Halloween Reoccurence
« on: 03. November 2017, 07:17:17 »
OK so too much candy = revolutions, rebellions and revolting retributions, with parades and fireworks thrown in for decoration. :D

8
Code and examples / Re: Halloween Reoccurence
« on: 01. November 2017, 19:54:47 »
Hi Cybermonkey,

Your Fasnet reminds me of New Orleans Mardi Gras.

Hi D,

Yes, feeding sugar to already overactive spirits is evil, that is the trick from a treat.


Dang it! I forgot JJ  :-[

Well maybe he doesn't go in for this child's play anyway?


Hi JJ,

How goes it with you and your part of the woods?


Oh and Peter!

Hi Peter,

I missed you too! heck, you might actually give the Re-occurrence a go at translation.


The scariest part of this whole deal is my spelling of reoccurrence.

9
Code and examples / Re: Halloween Reoccurence
« on: 01. November 2017, 02:32:49 »
Sorry, no screen shots. I didn't want to spoil the surprise ending.

JRS, maybe you will give us a shot?

D, feel free to Smash it after Halloween, with appropriate music of course. :D

Galileo, yes should work in YAB.

Rick3137 or Marcus, yep SdlBasic and Naalaa too!

Hi Richey, what do they do for Halloween across the pond? Anything special for teachers?

Hi Cybermonkey, and in Germany?

In the states, Halloween is second biggest holiday of year, some of the decorations are better than Christmas as far as imagination goes.

Who did I miss?

Aurel, but I hear they have Halloween every week in Croatia, so no big deal.

Mike, do you still visit?

10
Code and examples / Halloween Reoccurence
« on: 31. October 2017, 04:28:10 »
Another occurrence of another variation, kind of scary how it wont go away...

QB64 so I had to make my own ellipse and fill triangle subs.

Code: [Select]
_TITLE "Halloween Reoccurence 2017-10-29 bplus"
CONST xmax = 1100
CONST ymax = 740

SCREEN _NEWIMAGE(xmax, ymax, 32)
_SCREENMOVE 160, 2

RANDOMIZE TIMER
COMMON SHARED sx
cx = xmax / 2: cy = ymax / 2: pr = .49 * xmax
d = 1: sx = 0
WHILE 1
    pumpkin cx, cy, pr, 3
    sx = sx + rand%(-4, 4)
    IF sx > .7 * pr / 12 THEN d = -1 * d: sx = 0
    IF sx < -.7 * pr / 12 THEN d = -1 * d: sx = 0
    _DISPLAY
    _LIMIT 6
WEND

FUNCTION rand% (lo%, hi%)
    rand% = INT(RND * (hi% - lo% + 1)) + lo%
END FUNCTION

SUB pumpkin (cx, cy, pr, limit)
    'carve this!
    COLOR &HFFFF0000
    fEllipse cx, cy, pr, 29 / 35 * pr
    COLOR &HFF000000
    lastr = 2 / 7 * pr
    DO
        ellipse cx, cy, lastr, 29 / 35 * pr
        lastr = .5 * (pr - lastr) + lastr + 1 / 35 * pr
        IF pr - lastr < 1 / 80 * pr THEN EXIT DO
    LOOP

    ' 'flickering candle light
    COLOR _RGB(RND * 55 + 200, RND * 55 + 200, 120)

    ' eye sockets
    ftri cx - 9 * pr / 12, cy - 2 * pr / 12, cx - 7 * pr / 12, cy - 6 * pr / 12, cx - 3 * pr / 12, cy - 0 * pr / 12
    ftri cx - 7 * pr / 12, cy - 6 * pr / 12, cx - 3 * pr / 12, cy - 0 * pr / 12, cx - 2 * pr / 12, cy - 3 * pr / 12
    ftri cx + 9 * pr / 12, cy - 2 * pr / 12, cx + 7 * pr / 12, cy - 6 * pr / 12, cx + 3 * pr / 12, cy - 0 * pr / 12
    ftri cx + 7 * pr / 12, cy - 6 * pr / 12, cx + 3 * pr / 12, cy - 0 * pr / 12, cx + 2 * pr / 12, cy - 3 * pr / 12

    ' nose
    ftri cx, cy - rand%(2, 5) * pr / 12, cx - 2 * pr / 12, cy + 2 * pr / 12, cx + rand%(1, 2) * pr / 12, cy + 2 * pr / 12

    ' evil grin
    ftri cx - 9 * pr / 12, cy + 1 * pr / 12, cx - 7 * pr / 12, cy + 7 * pr / 12, cx - 6 * pr / 12, cy + 5 * pr / 12
    ftri cx + 9 * pr / 12, cy + 1 * pr / 12, cx + 7 * pr / 12, cy + 7 * pr / 12, cx + 6 * pr / 12, cy + 5 * pr / 12

    ' moving teeth/talk/grrrr..
    u = rand%(4, 8)
    dx = pr / u
    FOR i = 1 TO u
        tx1 = cx - 6 * pr / 12 + (i - 1) * dx
        tx2 = tx1 + .5 * dx
        tx3 = tx1 + dx
        ty1 = cy + 5 * pr / 12
        ty3 = cy + 5 * pr / 12
        ty2 = cy + (4 - RND) * pr / 12
        ty22 = cy + (6 + RND) * pr / 12
        ftri tx1, ty1, tx2, ty2, tx3, ty3
        ftri tx1 + .5 * dx, ty1, tx2 + .5 * dx, ty22, tx3 + .5 * dx, ty3
    NEXT
    IF limit THEN

        'shifty eyes
        IF limit = 3 THEN sxs = sx ELSE sxs = .1 * sx
        pumpkin sxs + cx - 5 * pr / 12, cy - 2.5 * pr / 12, .15 * pr, INT(limit - 1)
        pumpkin sxs + cx + 5 * pr / 12, cy - 2.5 * pr / 12, .15 * pr, INT(limit - 1)
    END IF
END SUB

SUB fEllipse (CX AS LONG, CY AS LONG, xRadius AS LONG, yRadius AS LONG)
    DIM scale AS SINGLE, x AS LONG, y AS LONG
    scale = yRadius / xRadius
    LINE (CX, CY - yRadius)-(CX, CY + yRadius), , BF
    FOR x = 1 TO xRadius
        y = scale * SQR(xRadius * xRadius - x * x)
        LINE (CX + x, CY - y)-(CX + x, CY + y), , BF
        LINE (CX - x, CY - y)-(CX - x, CY + y), , BF
    NEXT
END SUB

SUB ellipse (CX AS LONG, CY AS LONG, xRadius AS LONG, yRadius AS LONG)
    DIM scale AS SINGLE, xs AS LONG, x AS LONG, y AS LONG
    DIM lastx AS LONG, lasty AS LONG
    scale = yRadius / xRadius: xs = xRadius * xRadius
    PSET (CX, CY - yRadius): PSET (CX, CY + yRadius)
    lastx = 0: lasty = yRadius
    FOR x = 1 TO xRadius
        y = scale * SQR(xs - x * x)
        LINE (CX + lastx, CY - lasty)-(CX + x, CY - y)
        LINE (CX + lastx, CY + lasty)-(CX + x, CY + y)
        LINE (CX - lastx, CY - lasty)-(CX - x, CY - y)
        LINE (CX - lastx, CY + lasty)-(CX - x, CY + y)
        lastx = x: lasty = y
    NEXT
END SUB

SUB ftri (xx1, yy1, xx2, yy2, xx3, yy3)
    'make copies before swapping
    x1 = xx1: y1 = yy1: x2 = xx2: y2 = yy2: x3 = xx3: y3 = yy3
    'thanks Andy Amaya!
    'triangle coordinates must be ordered: where x1 < x2 < x3
    IF x2 < x1 THEN SWAP x1, x2: SWAP y1, y2
    IF x3 < x1 THEN SWAP x1, x3: SWAP y1, y3
    IF x3 < x2 THEN SWAP x2, x3: SWAP y2, y3
    IF x1 <> x3 THEN slope1 = (y3 - y1) / (x3 - x1)

    'draw the first half of the triangle
    length = x2 - x1
    IF length <> 0 THEN
        slope2 = (y2 - y1) / (x2 - x1)
        FOR x = 0 TO length
            LINE (INT(x + x1), INT(x * slope1 + y1))-(INT(x + x1), INT(x * slope2 + y1))
            'lastx2% = lastx%
            lastx% = INT(x + x1)
        NEXT
    END IF

    'draw the second half of the triangle
    y = length * slope1 + y1: length = x3 - x2
    IF length <> 0 THEN
        slope3 = (y3 - y2) / (x3 - x2)
        FOR x = 0 TO length
            'IF INT(x + x2) <> lastx% AND INT(x + x2) <> lastx2% THEN  'works! but need 2nd? check
            IF INT(x + x2) <> lastx% THEN
                LINE (INT(x + x2), INT(x * slope1 + y))-(INT(x + x2), INT(x * slope3 + y2))
            END IF
        NEXT
    END IF
END SUB

11
Code and examples / Fall Foliage
« on: 21. October 2017, 10:26:18 »
Code: [Select]
'fall foliage.bas SmallBASIC 0.12.9 (B+=MGA) 2017-10-21

'test landscape and portrait views for Android
xmx = min(xmax, 800) : ymx = min(600, ymax) 'portrait
'OK it's just plain better in landscape view

'now for full viewing enjoyment
xmx = xmax : ymx = ymax

n = 3
while 1
  if n < 15 then n = n + 3
  horizon = rand(.8 * ymx, .9 * ymx)
  for i= 0 to horizon
    midInk 0, 0, 128, 10, 120, 128, i/horizon
    line 0, i, xmx, i
  next
  for i = horizon to ymx
    midInk 70, 108, 30, 60, 10, 5, (i-horizon)/(ymx-horizon)
    line 0, i, xmx, i
  next
  for i = 1 to xmx * ymx * .00018
    leaf rand(0, xmx), rand(horizon * 1.002, ymx)
  next
  if n < .01 * xmx then trees = n else trees = rand(.01 * xmx, .03 * xmx)
  for i = 1 to trees
    y = horizon + .04 * ymx + i / trees * (ymx - horizon - .1 * ymx)
    r = .01 * y : h = rand(y * .15, y * .18)
    branch rand(10, xmx - 10), y, r, 90, h, 0
  next
  rect xmx, 0, xmax, ymax, 0 filled
  rect 0, ymx, xmx, ymax, 0 filled
  showpage
  delay 2000
wend

sub branch(x, y, startr, angD, length, lev)
  local x2, y2, dx, dy, bc, i
  x2 = x + cos(rad(angD)) * length
  y2 = y - sin(rad(angD)) * length
  dx = (x2 - x) / length
  dy = (y2 - y) / length
  bc = rgb(30 + 6 * lev, 15 + 3 * lev, 5 + 2 * lev)
  for i = 0 to length
    circle x + dx * i, y + dy * i, startr, 1, bc filled
  next
  if lev > 1 then leaf x2, y2
  if .8 * startr < .1 or lev > 7 or length < 3 then exit sub
  lev += 1
  branch x2, y2, .8 * startr, angD + 22 + rand(-10, 19), rand(.75 * length, .9 * length), lev
  branch x2, y2, .8 * startr, angD - 22 - rand(-10, 19), rand(.75 * length, .9 * length), lev
end

sub leaf(x, y)
   local sp, n, c, xoff, yoff, woff, hoff
   sp = 15 : leafs = rand(xmx * ymx * .00001, xmx * ymx * .00002)
   for n = 1 to leafs
      c = rgb(rand(50, 250), rand(25, 255), rand(0, 40))
      xoff = x + rnd * sp - rnd * sp
      yoff = y + rnd * sp - rnd * sp
      woff = 3 + rnd * 3
      hoff = 3 + rnd * 3
      rect xoff, yoff step woff, hoff, c filled
   next
end

sub midInk(r1, g1, b1, r2, g2, b2, fr)
  color rgb(r1 + (r2 - r1) * fr, g1 + (g2 - g1) * fr, b1 + (b2 - b1) * fr)
end

def rand(lo, hi) = (rnd * (hi - lo + 1)) \ 1 + lo


12
If you take requests, how about some waterfalls?

BTW, I hope you get a few more days off from work. ;)

13
So Cool!  :)

I remember you had a thread going at BP.org ? and I tried to translate to SmallBASIC and failed.

I have recently viewed Anne M Burns fractal (or is it recursive) art. I love this kind of stuff!

14
Code and examples / Re: Here is my favorite screen saver from past
« on: 02. October 2017, 18:45:19 »
Hi D

Mystify, yeah! that's it. Thanks



Hi Marcus,

Yeah, I saw that at Naalaa, nice - more modern looking that Mystify. I don't remember your saying it was a screen saver from the past. I did try out the code and maybe that did plant the thought of trying to recreate my own clone of a favorite.

Well maybe your past does not go as far back as mine. Do you remember ever typing up a program on punch cards and having to wait a day or so only to find out you had a typo from your blank printout?  ...just Big Macs then.


15
Code and examples / Here is my favorite screen saver from past
« on: 30. September 2017, 15:13:32 »
This is all from memory, I tried to look up Mystic Screen saver and got nowhere... so I might have the name wrong.

SmallBASIC version:
Code: [Select]
' Mystic memories.bas SmallBASIC 0.12.9 (B+=MGA) 2017-09-29
' I modified from my posted 2017-09-29 for QB64
' Mystic screen saver as I remember it plus...

option predef antialias off  'runs faster (or smoother) might improve image
randomize timer
dim x(2), y(2), dx(2), dy(2)
for i = 0 to 2
    newPoint i
next
saveX = x : saveY = y : saveDX = dx : saveDY = dy
dmode = 1 : nT = 50
resetPlasma
while 1
  cls
  color 11
  ? " Number of triangles = ";nT;" press m for more, l for less,"
  ? " spacebar to change color, d for duplicate image toggle."
  cN = cN - nT + 1
  x = saveX : y = saveY : dx = saveDX : dy = saveDY
  for i = 0 to 2
    updatePoint i
  next
  saveX = x : saveY = y : saveDX = dx : saveDY = dy
  for j = 1 to nT
    for i = 0 to 2
      updatePoint i
    next
    changePlasma
    for i = 0 to 2
      line x(i), y(i), x((i+1) mod 3), y((i+1) mod 3)
    next
    if dmode = 1 then
      for i = 0 to 2
        line xmax - x(i), ymax - y(i), xmax - x((i+1) mod 3), ymax - y((i+1) mod 3)
      next
    end if
  next
  showpage
  delay 10
  k = inkey
  if k = " " then
    resetPlasma
  elif k = "d"
    dmode = not dmode
  elif k = "m"
    nT = nT + 1: if nT > 100 then nT = 100
  elif k = "l"
    nT = nT - 1: if nT < 1 then nT = 1
  fi
wend

sub newPoint(p)
  x(p) = RND * xmax
  y(p) = RND * ymax
  dx(p) = (RND * 10 + 1) * rdir
  dy(p) = (RND * 6 + 1) * rdir
end

sub updatePoint(p)
  if x(p) + dx(p) < 0 then dx(p) = -dx(p)
  if y(p) + dy(p) < 40 then dy(p) = -dy(p)
  if x(p) + dx(p) > xmax then dx(p) = -dx(p)
  if y(p) + dy(p) > ymax - 40 then dy(p) = -dy(p)
  x(p) = x(p) + dx(p)
  y(p) = y(p) + dy(p)
end

sub changePlasma ()
  cN = cN + 1
  color rgb(127 + 127 * sin(pR * .2 * cN), 127 + 127 * sin(pG * .2 * cN), 127 + 127 * sin(pB * .2 * cN))
end

sub resetPlasma ()
  pR = rnd ^ 2: pG = rnd ^ 2: pB = rnd ^ 2
end

func rdir()
  IF rnd < .5 THEN rdir = -1 ELSE rdir = 1
end




QB64 version (which you might see, no great difference in PL):
Code: [Select]
_TITLE "Mystic Memories by bplus, d toggles duplicate on/off, spacebar resets color, m = more, l = less triangles"
'posted 2017-09-29 for QB64, Mystic screen saver as I remember it plus...

RANDOMIZE TIMER
CONST xmax = 1100
CONST ymax = 700

TYPE point
    x AS INTEGER
    y AS INTEGER
    dx AS SINGLE
    dy AS SINGLE
END TYPE
COMMON SHARED pR, pG, pB, cN
SCREEN _NEWIMAGE(xmax, ymax, 32)
_SCREENMOVE (_DESKTOPWIDTH - xmax) / 2, (_DESKTOPHEIGHT - ymax) / 2 '_MIDDLE does not work?

DIM tri(2) AS point
FOR i = 0 TO 2
    newPoint tri(i)
NEXT
DIM saveP1 AS point
DIM saveP2 AS point
DIM saveP3 AS point
saveP1 = tri(0): saveP2 = tri(1): saveP3 = tri(2)
dmode = 0: nT = 50
resetPlasma
WHILE 1
    CLS , 0
    cN = cN - nT
    tri(0) = saveP1: tri(1) = saveP2: tri(2) = saveP3
    FOR i = 0 TO 2
        updatePoint tri(i)
    NEXT
    saveP1 = tri(0): saveP2 = tri(1): saveP3 = tri(2)
    FOR j = 1 TO nT
        FOR i = 0 TO 2
            updatePoint tri(i)
        NEXT
        changePlasma
        FOR i = 0 TO 2
            LINE (tri(i).x, tri(i).y)-(tri((i + 1) MOD 3).x, tri((i + 1) MOD 3).y)
        NEXT
        IF dmode THEN
            FOR i = 0 TO 2
                LINE (xmax - tri(i).x, ymax - tri(i).y)-(xmax - tri((i + 1) MOD 3).x, ymax - tri((i + 1) MOD 3).y)
            NEXT
        END IF
    NEXT
    _DISPLAY
    k$ = INKEY$
    IF k$ = " " THEN
        resetPlasma
    ELSEIF k$ = "d" THEN
        dmode = NOT dmode
    ELSEIF k$ = "m" THEN
        nT = nT + 1: IF nT > 500 THEN nT = 500
    ELSEIF k$ = "l" THEN
        nT = nT - 1: IF nT < 1 THEN nT = 1
    END IF
    _LIMIT 10
WEND

SUB newPoint (p AS point)
    p.x = RND * xmax
    p.y = RND * ymax
    p.dx = (RND * 10 + 1) * rdir
    p.dy = (RND * 6 + 1) * rdir
END SUB

SUB updatePoint (p AS point)
    IF p.x + p.dx < 0 THEN p.dx = p.dx * -1
    IF p.y + p.dy < 0 THEN p.dy = p.dy * -1
    IF p.x + p.dx > xmax THEN p.dx = p.dx * -1
    IF p.y + p.dy > ymax THEN p.dy = p.dy * -1
    p.x = p.x + p.dx
    p.y = p.y + p.dy
END SUB

SUB changePlasma ()
    cN = cN + 1
    COLOR _RGB(127 + 127 * SIN(pR * .1 * cN), 127 + 127 * SIN(pG * .1 * cN), 127 + 127 * SIN(pB * .1 * cN))
END SUB

SUB resetPlasma ()
    pR = RND ^ 2: pG = RND ^ 2: pB = RND ^ 2
END SUB

FUNCTION rdir% ()
    IF RND < .5 THEN rdir% = -1 ELSE rdir% = 1
END FUNCTION



Maybe you guys have a favorite cloned from the past?

Pages: [1] 2 3 ... 29