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

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
Im posting the "PAC MAN" code here that I lost interest with.

I've compiled it, nice stuff!



Thanks to albert.  You know, even though theres no game there - you can still find yourelf trying to outwit the stalkers when you try it out. Cheers Albert.
I like things and do stuff.

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
I've assembled the first few codesnippets into one bundle.

Also I've shot some screenshots:

Tunnel
Spiral1
Spiral2
PolySpiral2
Patterns1
Patterns2
Bat 'n ball
Flag
Wormhole

Thanx for the slideshow Albert. I started the thread to show that it only takes a few lines of code to display an idea.  I kept the examples short with variables that could be changed/understood by the user. Its all simple stuff which I hope has helped to inspire others to try out the Basic for themselves( and mess with Math). No Functions, no complicated calls etc - just basic see & read, then alter.

When I release the Sprite Creator - called Hyper Sprite for now - I hope you enjoy it friend and find it useful.

Albert, I look forward to your next submissions with great interest. 
I like things and do stuff.

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
That list is quite promising!
I´m particularly found of:


light table for animations
stencil for the outlines, easier to color something?

Ive now added a stencil routine that ignores a colour  - stops painting over it.  Can also be used as a freehand fill.

Please explain light table for animations. I`m old :) but interested in you idea.

Cheers.

Mr Brick
I like things and do stuff.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4228
    • View Profile
    • Portfolio
Please explain light table for animations. I`m old :) but interested in you idea.

Is like having control of transparency overlay of frames around the current, for example, let´s suppose I´m drawing a walking cycle animation of my main caracter, only outline, I draw first frame, when advance to next one, the one before is there but untouchable on a 50% transparent level.
That way it is easy for people do draw a bit over the last frame, helps a lot on timing animations.

Some programs you can choose how many frames before and after the current one and a set o transparency decay.

Name Lightable comes from a traditional animator´s table that has similar effect.

PS:there is a pic of a more homebrew light table (also called light box maybe) on the left and the ´transparent´layer effect on a physical version.
   

[attachment deleted by admin]

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1543
    • View Profile
It's cool looking.

So now just make it cooler by connecting the visuals into a spectrum analyzer :good:, if you can find the update lib for fmod.  :zzz:

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
Please explain light table for animations. I`m old :) but interested in you idea.

Is like having control of transparency overlay of frames around the current, for example, let´s suppose I´m drawing a walking cycle animation of my main caracter, only outline, I draw first frame, when advance to next one, the one before is there but untouchable on a 50% transparent level.
That way it is easy for people do draw a bit over the last frame, helps a lot on timing animations.

Some programs you can choose how many frames before and after the current one and a set o transparency decay.

Name Lightable comes from a traditional animator´s table that has similar effect.

PS:there is a pic of a more homebrew light table (also called light box maybe) on the left and the ´transparent´layer effect on a physical version.
 

Ahh, back in my day it was called the Onion skin effect.(That term sounds like summit Abe Simpson would say) I suppose spriting to mem and some feint darkening/tinting could be a start with that. I`ll give it a bash this weekend. 

A nice bit of homebrew DIY there Erico and I bet that saved you a few bucks.  DIY and me dont mix to well.  My last offering was a piece of wood that I had aimlessly banged nails into...cough... :D
I like things and do stuff.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4228
    • View Profile
    • Portfolio
Ahh, back in my day it was called the Onion skin effect...
...A nice bit of homebrew DIY there Erico and I bet that saved you a few bucks...

Yeah, onion skin is the name, I must have forgotten such since I am the "no onions no pickles" kind of human =D

That homebrew is not mine, I did assemble one long time ago but a lot more ugly then that, some chaps sells a similar great one every Animamundi festival though.
Since I have a wacom tablet and a scanner, I have no need to indulge in time consuming hand animation anymore.

It is great you are going to give a try!

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
Heres my method of doing this.

1.First we need an image to trace over. (Sprite/BMP)

2.Make a copy & reduce its RGB.(Sprite2Mem - Mem2Sprite)

3.Expand the copy to a size easy to trace over. (ZoomSprite)

4.Get the mouse moving, with a cursor and measurement.

5.Each button press fills a new sprite(new sheet) with pixels.

6.This new (sheet) sprite is then expanded over the copy(s).

7.Creating a visual effect of drawing over the enlarged (original) copy.

8.Go back to 3

9.Create a "NEW SHEET" button to allow a new blank sprite. (Sheet)

9.Set the new sprite as the new sheet over the previous.

10. Display it below next to the other frames. (Like a movie strip)

11. Reduce the RGB of the copy, previous sprite (sheet) etc.

11. Draw them enlarged & return 3.

« Last Edit: 2012-May-26 by I love my Brick »
I like things and do stuff.

Offline Albert

  • Dr. Type
  • ****
  • Posts: 257
    • View Profile
    • Blog

I started the thread to show that it only takes a few lines of code to display an idea.  I kept the examples short with variables that could be changed/understood by the user. Its all simple stuff which I hope has helped to inspire others to try out the Basic for themselves( and mess with Math). No Functions, no complicated calls etc - just basic see & read, then alter.

I'm totally understand it, and I tried to keep the original code as is, only breaked each of them into two pieces: initialize and process.
I see what you mean, and I'm also a fan of the one-file one-shot programs, could I suggest you http://cymonsgames.com/? This site contains lot of type-in programs, also you can submit your own (only c++ was in the past, but things changes). The site's favicon created by me! :D

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
Super nice Albert.  I will check out that site and enjoy every minute friend.

Ahh, back in the day when computer mags displayed black n white pics of games...and then you found the type-in section.  You brought back many memories my friend of times long past.  Lets not forget the POKE routines for cheating in games too...great times, long gone :) 

Cheers me dears!
I like things and do stuff.

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1635
  • Particle Hawk
    • View Profile
Hi Brick, great visualizations for music!

I have an idea which can be implemented into your image editor..
Beziers lines, you know the bendy snake like lines in windows paint?
http://www.glbasic.com/forum/index.php?topic=3839.0
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
Thanks & yes I can see that - the beginning of a media player type thing.

I havnt implemented your suggestion into the code but it has crossed my mind in the past.  Another thing to put on my pen and paper list - page 2.  Completion of one routine always springs new ideas :)  I`m currently coding a symmetry type thingy like that found in Deluxe Paint. (Instead of one cursor on the grid you can now have more that move in relation to a central point.  Think SPIROGRAPH and you`ll understand what i mean)

 
I like things and do stuff.

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
Below: A simple example of what I`m adding to the Sprite/image editor.

///////////////////////////////////////////////////////////////////////////////////////////
// 16 lines of code
// mirror drawn image - use mouse with left button held down to paint.
// dont use RND inside the RGB as it slows things down.
///////////////////////////////////////////////////////////////////////////////////////////

GETSCREENSIZE w,h

GRABSPRITE 0,0,0,w,h

WHILE TRUE

DRAWSPRITE 0,0,0 // draw current display

MOUSESTATE mx, my, b1, b2 // read da mouse

IF b1=1 // button pressed

FOR a=0 TO 360 STEP 5 // change the "STEP" for different effects
SETPIXEL 300+COS(a+mx)*50+mx,200+SIN(a+my)*50+my,RGB(255,a,0)
SETPIXEL 300+COS(a+mx)*50-mx,200+SIN(a+my)*50+my,RGB(100,a,a)
SETPIXEL 300+COS(a+mx)*50-mx,200+SIN(a+my)*50-my,RGB(255,a,a/2)
SETPIXEL 300+COS(a+mx)*50+mx,200+SIN(a+my)*50-my,RGB(100,a,a/3)
NEXT

ENDIF

GRABSPRITE 0,0,0,w,h // grab new screen display

SHOWSCREEN

WEND
I like things and do stuff.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4228
    • View Profile
    • Portfolio
pretty good looking effect and mirrors.
kaleidoscopio especial!

Offline I love my Brick

  • Mr. Drawsprite
  • **
  • Posts: 61
    • View Profile
Hey Erico, I hope you manage to get Father Ted - you will love it and laugh! :D
////////////////////////////////////////////////////////////////////////////////////////////////////
Try using DRAWRECT in different sizes instead of SETPIXEL (like the tunnel thing I did)
E.G.: if xpos is at mx=100 enlarge DRAWRECT by two - a zoomed image.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
OR mutiply the SETPIXEL to 8 instead of 4 - toy with minus and plus within COS & SIN
/////////////////////////////////////////////////////
Hope it helps with your creative ideas - cos you will have ideas I cannot see.
/////////////////////////////////////////////////////////////////////////////////////////////////

Cheers

Mark
 
I like things and do stuff.