• Welcome to Dark Bit Factory & Gravity.
 

Letter Scrambler Two...

Started by bikemadness, July 23, 2007

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

bikemadness

This one is a combination of 'shifting blocks' and a finished version of 'letter scrambler'.

X to activate


open window 640,512
a$="DBFINTERACTIVEISTHETOPS"
L=len(a$)
A=(((26-L)/2)*15)
B=100
dim xm(26),xs(26),ym(26),sp(26),dist(26),ranht(26)
for a=1 to 26
sp(a)=0
ym(a)=400
ranht=ran(0.2)
text (xm(a)*15)+A+B,ym(a),mid$(a$,a,1)
next a
repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window
setrgb 1,200,200,0
fill rectangle 0,0 to 640,512
D=peek("port1")
go=go+1
if go>20 go=20
for a=1 to 26
ranht(a)=ran(0.2)
dist(a)=abs(xm(a)-xs(a))
if xm(a)>xs(a) xm(a)=xm(a)-.2
if xm(a)<xs(a) xm(a)=xm(a)+.2
sp(a)=sp(a)-ranht(a)
ym(a)=ym(a)-sp(a)
if ym(a)>400 then
ym(a)=400
sp(a)=0
endif
if and(D,16384)>0 sp(a)=5
if and(D,16384)>0 and go=20 then
go=0
1 xs(1)=int(ran(L))+1
2 xs(2)=int(ran(L))+1
if xs(2)=xs(1) goto 2
3 xs(3)=int(ran(L))+1
if xs(3)=xs(2) or xs(3)=xs(1) goto 3
if L=3 goto fin
4 xs(4)=int(ran(L))+1
if xs(4)=xs(3) or xs(4)=xs(2) or xs(4)=xs(1) goto 4
if L=4 goto fin
5 xs(5)=int(ran(L))+1
if xs(5)=xs(4) or xs(5)=xs(3) or xs(5)=xs(2) or xs(5)=xs(1) goto 5
if L=5 goto fin
6 xs(6)=int(ran(L))+1
if xs(6)=xs(5) or xs(6)=xs(4) or xs(6)=xs(3) or xs(6)=xs(2) or xs(6)=xs(1) goto 6
if L=6 goto fin
7 xs(7)=int(ran(L))+1
if xs(7)=xs(6) or xs(7)=xs(5) or xs(7)=xs(4) or xs(7)=xs(3) or xs(7)=xs(2) or xs(7)=xs(1) goto 7
if L=7 goto fin
8 xs(8)=int(ran(L))+1
if xs(8)=xs(7) or xs(8)=xs(6) or xs(8)=xs(5) or xs(8)=xs(4) or xs(8)=xs(3) or xs(8)=xs(2) or xs(8)=xs(1) goto 8
if L=8 goto fin
9 xs(9)=int(ran(L))+1
if xs(9)=xs(8) or xs(9)=xs(7) or xs(9)=xs(6) or xs(9)=xs(5) or xs(9)=xs(4) or xs(9)=xs(3) or xs(9)=xs(2) or xs(9)=xs(1) goto 9
if L=9 goto fin
10 xs(10)=int(ran(L))+1
if xs(10)=xs(9) or xs(10)=xs(8) or xs(10)=xs(7) or xs(10)=xs(6) or xs(10)=xs(5) or xs(10)=xs(4) or xs(10)=xs(3) or xs(10)=xs(2) or xs(10)=xs(1) goto 10
if L=10 goto fin
11 xs(11)=int(ran(L))+1
if xs(11)=xs(10) or xs(11)=xs(9) or xs(11)=xs(8) or xs(11)=xs(7) or xs(11)=xs(6) or xs(11)=xs(5) or xs(11)=xs(4) or xs(11)=xs(3) or xs(11)=xs(2) or xs(11)=xs(1) goto 11
if L=11 goto fin
12 xs(12)=int(ran(L))+1
if xs(12)=xs(11) or xs(12)=xs(10) or xs(12)=xs(9) or xs(12)=xs(8) or xs(12)=xs(7) or xs(12)=xs(6) or xs(12)=xs(5) or xs(12)=xs(4) or xs(12)=xs(3) or xs(12)=xs(2) or xs(12)=xs(1) goto 12
if L=12 goto fin
13 xs(13)=int(ran(L))+1
if xs(13)=xs(12) or xs(13)=xs(11) or xs(13)=xs(10) or xs(13)=xs(9) or xs(13)=xs(8) or xs(13)=xs(7) or xs(13)=xs(6) or xs(13)=xs(5) or xs(13)=xs(4) or xs(13)=xs(3) or xs(13)=xs(2) or xs(13)=xs(1) goto 13
if L=13 goto fin
14 xs(14)=int(ran(L))+1
if xs(14)=xs(13) or xs(14)=xs(12) or xs(14)=xs(11) or xs(14)=xs(10) or xs(14)=xs(9) or xs(14)=xs(8) or xs(14)=xs(7) or xs(14)=xs(6) or xs(14)=xs(5) or xs(14)=xs(4) or xs(14)=xs(3) or xs(14)=xs(2) or xs(14)=xs(1) goto 14
if L=14 goto fin
15 xs(15)=int(ran(L))+1
if xs(15)=xs(14) or xs(15)=xs(13) or xs(15)=xs(12) or xs(15)=xs(11) or xs(15)=xs(10) or xs(15)=xs(9) or xs(15)=xs(8) or xs(15)=xs(7) or xs(15)=xs(6) or xs(15)=xs(5) or xs(15)=xs(4) or xs(15)=xs(3) or xs(15)=xs(2) or xs(15)=xs(1) goto 15
if L=15 goto fin
16 xs(16)=int(ran(L))+1
if xs(16)=xs(15) or xs(16)=xs(14) or xs(16)=xs(13) or xs(16)=xs(12) or xs(16)=xs(11) or xs(16)=xs(10) or xs(16)=xs(9) or xs(16)=xs(8) or xs(16)=xs(7) or xs(16)=xs(6) or xs(16)=xs(5) or xs(16)=xs(4) or xs(16)=xs(3) or xs(16)=xs(2) or xs(16)=xs(1) goto 16
if L=16 goto fin
17 xs(17)=int(ran(L))+1
if xs(17)=xs(16) or xs(17)=xs(15) or xs(17)=xs(14) or xs(17)=xs(13) or xs(17)=xs(12) or xs(17)=xs(11) or xs(17)=xs(10) or xs(17)=xs(9) or xs(17)=xs(8) or xs(17)=xs(7) or xs(17)=xs(6) or xs(17)=xs(5) or xs(17)=xs(4) or xs(17)=xs(3) or xs(17)=xs(2) or xs(17)=xs(1) goto 17
if L=17 goto fin
18 xs(18)=int(ran(L))+1
if xs(18)=xs(17) or xs(18)=xs(16) or xs(18)=xs(15) or xs(18)=xs(14) or xs(18)=xs(13) or xs(18)=xs(12) or xs(18)=xs(11) or xs(18)=xs(10) or xs(18)=xs(9) or xs(18)=xs(8) or xs(18)=xs(7) or xs(18)=xs(6) or xs(18)=xs(5) or xs(18)=xs(4) or xs(18)=xs(3) or xs(18)=xs(2) or xs(18)=xs(1) goto 18
if L=18 goto fin
19 xs(19)=int(ran(L))+1
if xs(19)=xs(18) or xs(19)=xs(17) or xs(19)=xs(16) or xs(19)=xs(15) or xs(19)=xs(14) or xs(19)=xs(13) or xs(19)=xs(12) or xs(19)=xs(11) or xs(19)=xs(10) or xs(19)=xs(9) or xs(19)=xs(8) or xs(19)=xs(7) or xs(19)=xs(6) or xs(19)=xs(5) or xs(19)=xs(4) or xs(19)=xs(3) or xs(19)=xs(2) or xs(19)=xs(1) goto 19
if L=19 goto fin
20 xs(20)=int(ran(L))+1
if xs(20)=xs(19) or xs(20)=xs(18) or xs(20)=xs(17) or xs(20)=xs(16) or xs(20)=xs(15) or xs(20)=xs(14) or xs(20)=xs(13) or xs(20)=xs(12) or xs(20)=xs(11) or xs(20)=xs(10) or xs(20)=xs(9) or xs(20)=xs(8) or xs(20)=xs(7) or xs(20)=xs(6) or xs(20)=xs(5) or xs(20)=xs(4) or xs(20)=xs(3) or xs(20)=xs(2) or xs(20)=xs(1) goto 20
if L=20 goto fin
21 xs(21)=int(ran(L))+1
if xs(21)=xs(20) or xs(21)=xs(19) or xs(21)=xs(18) or xs(21)=xs(17) or xs(21)=xs(16) or xs(21)=xs(15) or xs(21)=xs(14) or xs(21)=xs(13) or xs(21)=xs(12) or xs(21)=xs(11) or xs(21)=xs(10) or xs(21)=xs(9) or xs(21)=xs(8) or xs(21)=xs(7) or xs(21)=xs(6) or xs(21)=xs(5) or xs(21)=xs(4) or xs(21)=xs(3) or xs(21)=xs(2) or xs(21)=xs(1) goto 21
if L=21 goto fin
22 xs(22)=int(ran(L))+1
if xs(22)=xs(21) or xs(22)=xs(20) or xs(22)=xs(19) or xs(22)=xs(18) or xs(22)=xs(17) or xs(22)=xs(16) or xs(22)=xs(15) or xs(22)=xs(14) or xs(22)=xs(13) or xs(22)=xs(12) or xs(22)=xs(11) or xs(22)=xs(10) or xs(22)=xs(9) or xs(22)=xs(8) or xs(22)=xs(7) or xs(22)=xs(6) or xs(22)=xs(5) or xs(22)=xs(4) or xs(22)=xs(3) or xs(22)=xs(2) or xs(22)=xs(1) goto 22
if L=22 goto fin
23 xs(23)=int(ran(L))+1
if xs(23)=xs(22) or xs(23)=xs(21) or xs(23)=xs(20) or xs(23)=xs(19) or xs(23)=xs(18) or xs(23)=xs(17) or xs(23)=xs(16) or xs(23)=xs(15) or xs(23)=xs(14) or xs(23)=xs(13) or xs(23)=xs(12) or xs(23)=xs(11) or xs(23)=xs(10) or xs(23)=xs(9) or xs(23)=xs(8) or xs(23)=xs(7) or xs(23)=xs(6) or xs(23)=xs(5) or xs(23)=xs(4) or xs(23)=xs(3) or xs(23)=xs(2) or xs(23)=xs(1) goto 23
if L=23 goto fin
24 xs(24)=int(ran(L))+1
if xs(24)=xs(23) or xs(24)=xs(22) or xs(24)=xs(21) or xs(24)=xs(20) or xs(24)=xs(19) or xs(24)=xs(18) or xs(24)=xs(17) or xs(24)=xs(16) or xs(24)=xs(15) or xs(24)=xs(14) or xs(24)=xs(13) or xs(24)=xs(12) or xs(24)=xs(11) or xs(24)=xs(10) or xs(24)=xs(9) or xs(24)=xs(8) or xs(24)=xs(7) or xs(24)=xs(6) or xs(24)=xs(5) or xs(24)=xs(4) or xs(24)=xs(3) or xs(24)=xs(2) or xs(24)=xs(1) goto 24
if L=24 goto fin
25 xs(25)=int(ran(L))+1
if xs(25)=xs(24) or xs(25)=xs(23) or xs(25)=xs(22) or xs(25)=xs(21) or xs(25)=xs(20) or xs(25)=xs(19) or xs(25)=xs(18) or xs(25)=xs(17) or xs(25)=xs(16) or xs(25)=xs(15) or xs(25)=xs(14) or xs(25)=xs(13) or xs(25)=xs(12) or xs(25)=xs(11) or xs(25)=xs(10) or xs(25)=xs(9) or xs(25)=xs(8) or xs(25)=xs(7) or xs(25)=xs(6) or xs(25)=xs(5) or xs(25)=xs(4) or xs(25)=xs(3) or xs(25)=xs(2) or xs(25)=xs(1) goto 26
if L=25 goto fin
26 xs(26)=int(ran(L))+1
if xs(26)=xs(25) or xs(26)=xs(24) or xs(26)=xs(23) or xs(26)=xs(22) or xs(26)=xs(21) or xs(26)=xs(20) or xs(26)=xs(19) or xs(26)=xs(18) or xs(26)=xs(17) or xs(26)=xs(16) or xs(26)=xs(15) or xs(26)=xs(14) or xs(26)=xs(13) or xs(26)=xs(12) or xs(26)=xs(11) or xs(26)=xs(10) or xs(26)=xs(9) or xs(26)=xs(8) or xs(26)=xs(7) or xs(26)=xs(6) or xs(26)=xs(5) or xs(26)=xs(4) or xs(26)=xs(3) or xs(26)=xs(2) or xs(26)=xs(1) goto 26
if L=26 goto fin
endif
label fin
setrgb 1,0,0,0
text (xm(a)*15)+A+B,ym(a),mid$(a$,a,1)
next a
until (1=0)


Have a Yahappy day
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.

Clanky

Nice effect.
Was it complicated to get right?
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

bikemadness

Certainly was. I always wanted to achieve it from the beginning. Couldn't wait to master enough code to realize it.

Have a Yahappy day.
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.

Shockwave

That is so cool.
Do you mind if I use the idea?
Shockwave ^ Codigos
Challenge Trophies Won:

bikemadness

Thanks. And please, do.
I don't develope my ideas much past a practical example or use of the code.
I'd like to see what you'll have in mind.

Have a Yahappy day.
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.

Shockwave

Cheers :) I'll use it in an intro soon!
Shockwave ^ Codigos
Challenge Trophies Won:

Clanky

Starting YaBasic again Shock??? Or just use the principle for a different language?
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

bikemadness

I've modified the code to make the letter toss a little more elegant.
It had been bothering me.

Have a Yahappy day.
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.

Shockwave

Quote from: CLANKY on July 27, 2007
Starting YaBasic again Shock??? Or just use the principle for a different language?

I'm just going to use a similar looking idea in something I am making :) It'll be in freebasic.
Shockwave ^ Codigos
Challenge Trophies Won:

Jim

Nice fx!  I'm trying to work out the logic of it - there must be an easier way than all those if checks... :)

Jim
Challenge Trophies Won:

bikemadness

I feel the same way about some of my old stuff. I constantly see short-cut improvements as I gain experience.
The scrambler used to be a lot longer.
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.

rain_storm

Yes there are too many if statements probably you could use one 'on x goto' statement but would still have to apply if logic to set the state of x correctly so thats a hard one to solve it works great as is though so you dont need to fix it

Challenge Trophies Won: