Author Topic: yabasic demo  (Read 6889 times)

0 Members and 1 Guest are viewing this topic.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
yabasic demo
« on: October 18, 2006 »
I wrote this to see if I really understood Shockwave's lovely twisting bar code, and I wrote it in yabasic just to prove it can still be done, and then I added copper bars because no demo is complete without copper bars is it?
Have fun!
Jim

Code: [Select]
'twisty fatty shrinky barry thing, with copper bars
'by Jim 18/10/2006
sw=640
sh=512
hsw=sw/2
open window sw,sh

'twisty barry thing stuff
ascale=3.14/180
w=100
inc=0
iinc=0.01
dim c(4,3)
c(0,0)=255:c(0,1)=0:c(0,2)=0
c(1,0)=0:c(1,1)=0:c(1,2)=255
c(2,0)=0:c(2,1)=255:c(2,2)=0
c(3,0)=255:c(3,1)=255:c(3,2)=0
c(4,0)=c(0,0):c(4,1)=c(0,1):c(4,2)=c(0,2)

'copper bar stuff
dim cuy(3)
dim cui(3)
dim rgb(3)
cuy(0)=0:cuy(1)=0:cuy(2)=0
cui(0)=.005:cui(1)=.007:cui(2)=.012
cuh=80

repeat
setdispbuf d
d=1-d
setdrawbuf d
clear window

copperbars()

a=0
inc=inc+iinc
for y=0 to sh-100*abs(inc)
x1 = w * (7+abs(inc))/7 * sin(a*ascale)
x2 = w * (7+abs(inc))/7 * cos(a*ascale)
x1=abs(x1):x2=abs(x2)
q=int(a/90)
if and(q,1)<>0 then
t = x1:x1 = x2:x2 = t
fi
ow = hsw-((x1+x2)/2)
setrgb 1,c(q+1,0),c(q+1,1),c(q+1,2)
line ow,y,ow+x1,y
setrgb 1,c(q,0),c(q,1),c(q,2)
line ow+x1,y,ow+x1+x2,y
a=a+inc
if a<0 a=a+360
if a>=360 a=a-360
next
if inc>2 or inc<-2 iinc=-iinc
until (peek("port1")<>0)

sub copperbars()
for y=0 to sh-1
rgb(0)=0
rgb(1)=0
rgb(2)=0
for c=0 to 2
if y>cuy(c) and y<cuy(c)+cuh then
rgb(c)=(cuh/2-abs(y-cuy(c)-(cuh/2)))*(255/cuh)
fi
cuy(c)=cuy(c)+cui(c)
if cuy(c)>=sh-cuh or cuy(c)<=0 then
cui(c)=-cui(c)
fi
next
if rgb(0)<>0 or rgb(1)<>0 or rgb(2)<>0 then
setrgb 1,rgb(0),rgb(1),rgb(2)
line 0,y,sw,y
fi
next
end sub

<edit>it was fast already, but I just stopped it drawing black where there are no copper bars
« Last Edit: October 18, 2006 by Jim »
Challenge Trophies Won:

Offline Clanky

  • Laser Guided Memories
  • Amiga 1200
  • ****
  • Posts: 340
  • Karma: 16
  • kiss that sound that pounds your senses
    • View Profile
Re: yabasic demo
« Reply #1 on: October 18, 2006 »
haha! Real Neat!
wish i could program like that!!
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: yabasic demo
« Reply #2 on: October 18, 2006 »
That rules  ;D
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: yabasic demo
« Reply #3 on: October 18, 2006 »
Well, they do say imitation is the sincerest form of flattery ;)

Jim
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: yabasic demo
« Reply #4 on: October 19, 2006 »
Is this a really dumb question (basic being interpreted) but can I get an exe?
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: yabasic demo
« Reply #5 on: October 19, 2006 »
You have to download the interpreter from here http://members.iinet.net.au/~jimshaw/Yabasic/ps2yabasic1.6b3.zip

Jim
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: yabasic demo
« Reply #6 on: October 19, 2006 »
Taj, if you try and copy / paste this or any other yabasic program into Jims excellent emulator, make sure that you add an extra return at the end of the source or it won't run.
This is not a fault of the emulator, it's the way Yabasic is.

There are a shed load of cool things written in Yabasic, I wrote dozens of demos myself, and a few games too.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: yabasic demo
« Reply #7 on: October 19, 2006 »
OK thanks guys, I got the emulator and ran the demo which is very nest for so little code (I like that :-). It says PS2 on the windows, what has yaBasic got to do with PS2?

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: yabasic demo
« Reply #8 on: October 19, 2006 »
The PS2 came with a demo disk (European Pal PS2's) and on that disk was a very bugged and very cool basic language that you could use the joypad as a keyboard and save your programs (which had to use in built gfx , polygons, dots ,lines) and no sound effects.

Some really cool stuff was made with it.
I'm decided, I'm going to have a trawl through my demos and add some of them in here!
Shockwave ^ Codigos
Challenge Trophies Won: