Toying with COS & SIN commands to produce 2D effects.

Previous topic - Next topic

I love my Brick

Welcome to all.

Below are a few progs that create dazzling eye candy. No doubt there are far easier methods of achieving what Ive included here - if so show me as I learning all the time :)

[attachment deleted by admin]
I like things and do stuff.

I love my Brick

The one above creates a simple wobbly vortex.

This next one produces a spiral that slowly unravels itself.

[attachment deleted by admin]
I like things and do stuff.

I love my Brick

This next one generates a pattern made out of lines - press space to reveal a new one.

[attachment deleted by admin]
I like things and do stuff.

I love my Brick

#3
Using drawrect, this next sample displays a screen size explosion in multicolour simplicity.

It could also pass as a primitve psychedelic show too. :)

[attachment deleted by admin]
I like things and do stuff.

Kitty Hello

very nice. You need to set the project/options "explicit declaratinos" on, because your last example had a typo... ;)

matchy

Good job. Nothing like a bit of smash coding.  :zzz:

Slydog

Well, that wasted 15 minutes of my day!
Couldn't resist tweaking the values in your code, to see what changed!  :S
Very fun stuff, and in so little code.  :good:
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Wampus

Fun.  :good:

I added a poly to the spiral code. Very psychedelic.

Code (glbasic) Select
GLOBAL change,x,y,aa,col,ca,mel,xo,yo

change=20.0 // this excites the dots on screen

WHILE NOT FALSE

FOR aa=1 TO 12996 STEP change

INC ca, 0.1

mel = MOD(aa+ca,12996)

SELECT mel

CASE 1 TO 2166

col = RGB(255,INTEGER(mel/8.494117647058824),0)

CASE 2167 TO 4332

col = RGB(255-(mel-2166)/8.494117647058824, 255,0)

CASE 4333 TO 6498

col = RGB(0, 255, (mel-4332)/8.494117647058824)

CASE 6499 TO 8664

col = RGB(0, 255-(mel-6495)/8.494117647058824, 255)

CASE 8665 TO 10830

col = RGB((mel-8664)/8.494117647058824, 0, 255)

CASE 10831 TO 12996

col = RGB(255, 0, 255-(mel-10830)/8.494117647058824)

DEFAULT

col = RGB(128,128,128)

ENDSELECT

x=COS(aa)/36
y=SIN(aa)/36


SMOOTHSHADING TRUE
STARTPOLY -1, 0
ALPHAMODE 0.1
POLYVECTOR 322+y*aa,243+x*aa, 0, 0, col
POLYVECTOR 322+y*aa,243+xo*aa, 0, 10, col
POLYVECTOR 322+yo*aa,243+xo*aa, 10, 10, col
POLYVECTOR 323+yo*aa,243+x*aa, 10, 0, col
ALPHAMODE 0.1
ENDPOLY


ALPHAMODE 0.5
DRAWLINE 323+y*aa,243+x*aa, 323+yo*aa,243+xo*aa, col
DRAWRECT 322+y*aa,242+x*aa,3,3, RGB(196,196,196)

xo = x
yo = y

NEXT

INC change, 0.0333 // let the fun begin!
SHOWSCREEN
//KEYWAIT
WEND // infinity in action!

I love my Brick

Thats amazing!  I love it.

Now youve got me tinkering with your code :D  Its the best way to learn new tricks.

Thanks.

I like things and do stuff.

I love my Brick

...and heres one I prepared earlier.

[attachment deleted by admin]
I like things and do stuff.

Wampus

Good going! I especially like what you've done with the colour gradients.

I love my Brick

Heres a very simple looking bat and ball game with bricks that sway - yes i know its boring :). The bricks could easily become aliens and the bat a space ship. My next little bit of code will be a PAC MAN clone using much of the above to produce a wacky but fun experience :D

Use left and right cursors to move the bat.

[attachment deleted by admin]
I like things and do stuff.

mentalthink

Hi these examples are very nice... thanks for sharing...

I think this are the new Polibius  :D :D

Wampus

I've uploaded a video of your spiral thingy code with added polyvectors and trailbacks. Click here to see it. :)

erico

gasp cogh :O

looks wondefull, and that Slaygon tune is just awesome...have been thinking of this tune for a featured zombi apocalypse movie for quite some time.

Great code you guys, I´m afraid to check it and feel naive... :(