Author Topic: Toying with COS & SIN commands to produce 2D effects.  (Read 24061 times)

Offline fuzzy70

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 828
  • Look left, Look right, LOOK OUT!!
    • View Profile
I've uploaded a video of your spiral thingy code with added polyvectors and trailbacks. Click here to see it. :)

I like that a lot, even though it wants me to throw in the towel programming wise  :sick:

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
Erico and Fuzzy, it might look lovely but I'm not some uber-coder or something. It was an accident. I played with parameters without thinking much about it and that was the result.  :-[

Attached is the code so you can see how simple it actually is.

[EDIT: And yeah, that Slaygon track is awesome!]

[attachment deleted by admin]
« Last Edit: 2012-Feb-28 by Wampus »

Offline fuzzy70

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 828
  • Look left, Look right, LOOK OUT!!
    • View Profile
Thanks for posting the source, I am building up quite a nice collection now   =D

I am basically using them for learning purposes in how GLB works or how to achieve something in GLB. Types (as in functions in types etc) were one of my biggest problems but thanks to source posted on this forum & looking at how others have done it & why they did it that way has helped tremendously.

I started programming games on a ZX80 all the way up to an Amiga but when I switched to PC's many years ago writing tools/utils/apps basically took over & getting my mind back in track for games programming is taking a while (prob due to age  :D) but I will get there.

There are a few projects that I have done which have been halted/abandoned due to losing track or going in the wrong direction but all of them have served a purpose & have learnt a lot from them so they wasn't a waste of time.

Lee

"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Online erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4186
    • View Profile
    • Portfolio
I spare a  :coke: to I love bricks, you around?

I´m still afraid of checking the code hehe, better finish up my game first :-[

Online erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4186
    • View Profile
    • Portfolio
There are a few projects that I have done which have been halted/abandoned due to losing track or going in the wrong direction but all of them have served a purpose & have learnt a lot from them so they wasn't a waste of time.

me too, I wish I had them all, but unfortunantly, only a couple amiga games I did still survive, in code and aminet, the rest is lost :(
My mom kept some of my HQ books (ones me and my brother wrote from scratch), would pay fortunes for the lost ones + my lost games. Hint to nowadays dads...keep all your son´s codes!

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
I've uploaded a video of your spiral thingy code with added polyvectors and trailbacks. Click here to see it. :)

Wow, that is awfully nice. http://www.glbasic.com/forum/Smileys/glbasic/good.gif
I like things and do stuff.

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
The PacMan game is almost complete.  Its called Scape Ghost, you play a rogue spirit addicted to munching on pills :D The maze ripples along as an animated background mutates. 

Love the DotBall prog - welldone!
I like things and do stuff.

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
Heres two more progs to tinker with.

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

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4144
  • On the shoulders of giants.
    • View Profile
    • My Apps
Some pretty nice effects there :)
I came. I saw. I played.

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
Hi folks, wow this place looks bare and full of cobwebs.

Theres a few lines of code below that draw gradient Circles with hope that someone replies and sweeps up the webs :)  .... erm....cough...bring a brush.

(Since January of this year Ive been infused with creating a Sprite Designer for GLBasic.  Its come on well and is almost complete.)

Heres an example of how you can to draw colour/gradient circles. Press a Key to animate.



Code: GLBasic [Select]
GLOBAL x , y , radius , r , g , b , size , col

radius = 50

////
/////
// Da Loop
/////
////

WHILE TRUE // PRESS A KEY TO CONTINUE

        FOR loop = 1 TO 20+RND(10)

                x= RND(800) // New Xpos
               
                y= RND(800) // not used


                FOR a = 1 TO 90
       
                        random=RND(255) // ot used
       
                        r = a * 2
                        g = a + 1
                        b = g + 1

                        col=RGB(r,g,b)

                        DRAWLINE x-COS(a)*radius, size+SIN(a)*radius, x,size+SIN(a)*radius, col        
                       
                        DRAWLINE x+COS(a)*radius, size+SIN(a)*radius, x,size+SIN(a)*radius, col

                        DRAWLINE x+COS(a)*radius, size-SIN(a)*radius, x,size-SIN(a)*radius, col

                        DRAWLINE x-COS(a)*radius, size-SIN(a)*radius, x,size-SIN(a)*radius, col

                NEXT

//size=RND(700)

x=RND(700)

radius = 10 + RND(50)  // New size to shape

INC size ; IF size > 600 THEN size = 0  // Primitive scroll

NEXT

SHOWSCREEN
KEYWAIT
WEND
 
...

I hope it helps others with thier projects.
« Last Edit: 2012-May-15 by Moru »
I like things and do stuff.

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
To achieve a central, outward gradient all you need to do is shrink the circle around its x & Y pos.  You then increase the size of the circle by 1 and alter the RGB value to suit.

Have fun and I hope I helped someone with their needs.
I like things and do stuff.

Online erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4186
    • View Profile
    • Portfolio
Just tried! Great!

You know...on another thread, we were discussing about dinamic terrains with textures.
Now I see the results of your code, and it just inspired me that such method, could well be used to try and attempt that.

Really great! :good:

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
Hey Erico, I`m a 2D guy pulling all I can out of the hat. Its good news to know that Ive helped you. I look forward to seeing what you can display.

Im a veteran of the Amiga Days....yawn :)

Im currently coding a Sprite Editor/Creator and this previous code of mine was a idea for filled/non filled circles.

Glad it helped you buddy.
« Last Edit: 2012-May-15 by I love my Brick »
I like things and do stuff.

Online erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4186
    • View Profile
    • Portfolio
Thanks, the terrain generation is actually needed by another forum´s chap I was trying to help, but this sure really inspires.
I´m eager to see what you have going on the sprite editor/creator line of app.
 :good:

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
Well so far I have completed the following-

Draw
Line
Box (filled/outline)
Circle/Elipse (filled/outline)
Fill - one colour / gradient fill
flood fill(every target colour)
Shapes - vector images from my idea of what can help quickly to outline your idea
Flip - x & Y
Rotate
scroll - wrap around/null repeat
Twist - use the scroll buttons to slowly flip a sprite - like a spinning coin or power up? etc
48 colours to play with - Thats a challenge but better than having 100s of colours to get lost with.
I had started with 32x32/64x64/128x128 & now leave it at 64x64.
If you need to crop this to something. well thats in place for version 2.
Built in animator.
Built in canvass - draw them on screen and see how they look - you can cut a group out and save them as oe sprite.
Colour - alter RGB, darken,brighten
Cut - make a new image that draws on screen
paste - draw it
Copy - keep an image - to drop into a new sprite back
Save/Load
Undo / ....Why redo?

Im learning new tricks whilst coding this and toy with such ideas to implement them into version 1.

I also then see - I can improve this or that - etc.

Such is the life of a coder or creator :)
 


I like things and do stuff.