| View previous topic :: View next topic |
| Author |
Message |
JJPeerless
Joined: 20 Jun 2005 Posts: 82
|
Posted: Wed Jul 13, 2005 3:20 am Post subject: dot tunnel |
|
|
im trying to create the old "dot tunnel" effect used in many demo's on the psp...i already wrote my own drawCircle() routine..it draws circles based on the center x,y the radius and the color..
i could only find ONE site that explained how to do a dot tunnel..but it wasnt very thorough..it said
"draw a dark circle"
"move center of circle"
"increase radius and brightness"
"display circle"
"go back to step 2"
so i did this, it worked.....sorta..but you could only "travel" through the tunnel "once" like..once the radius got bigger than the screen...thats it.
so i thought of once radius gets big enough, reset it back to 0, and same with the color back to dark..
but then once it reset, the old circles were there and it just drew over them but they werent lined up..soo it just started to make a mess everywhere..
so then i tried clearing the screen after it reset..so now i was just going through the tunnel once..over and over again..still wasnt what i wanted..
so i cant really figure how to "continue" through the circle..
i have an example of what i want to accomplish.. oh and im using a SinTable to generate the Y values of the center Y..
www.geocities.com/jjpeerless1/tunnel.zip that is what im going for..
any guidance/help/ideas would be greatly appreciated.thanks. |
|
| Back to top |
|
 |
th0mas
Joined: 24 Apr 2005 Posts: 43 Location: Canada
|
Posted: Wed Jul 13, 2005 3:32 am Post subject: |
|
|
- learn polar coordinates, and how to convert from polar to cartesian
- randomly initialize coordinates.
- draw brighter/darker based on radius (larger radius = brighter)
- every move, make the radius 10% larger than it currently is (this will make a closer star move quicker than a further away star)
- regenerate the position of the star if, when you map the polar coordinate to x/y, it lands outside your screen
now when the user pressed L/R if you want, you can add/subtract an angle to the polar coordinate, making a "spinning" effect. _________________ http://th0mas.xbox-scene.com |
|
| Back to top |
|
 |
JJPeerless
Joined: 20 Jun 2005 Posts: 82
|
Posted: Wed Jul 13, 2005 3:36 am Post subject: |
|
|
are you saying to initialize coordinates for the first circle..or all of them?
so every "frame" i redraw all the old circles too?
i need some kind of data structure to hold the coordates of ALL the circles?
not just 1? |
|
| Back to top |
|
 |
JJPeerless
Joined: 20 Jun 2005 Posts: 82
|
Posted: Wed Jul 13, 2005 3:38 am Post subject: |
|
|
also..isnt converting from polar to cartesian just like this:
polar coord = (radius,angle)
cartesian coord would equal:
( radius*cos(angle),radius*sin(angle) )
whats the point of using polar coordinates? |
|
| Back to top |
|
 |
JJPeerless
Joined: 20 Jun 2005 Posts: 82
|
Posted: Wed Jul 13, 2005 3:44 am Post subject: |
|
|
also, i was just rereading your post..why are you talking about STAR's..
do you mean circles? |
|
| Back to top |
|
 |
ector
Joined: 12 May 2005 Posts: 195
|
Posted: Wed Jul 13, 2005 4:12 am Post subject: |
|
|
| You should clear the screen every frame and redraw the dot tunnel every frame, if you're trying to do the kind of dot tunnel I'm thinking of :) |
|
| Back to top |
|
 |
JJPeerless
Joined: 20 Jun 2005 Posts: 82
|
Posted: Wed Jul 13, 2005 4:24 am Post subject: |
|
|
| im trying to do the dot tunnel that you see in the link i posted in my first post. |
|
| Back to top |
|
 |
th0mas
Joined: 24 Apr 2005 Posts: 43 Location: Canada
|
Posted: Wed Jul 13, 2005 5:25 am Post subject: |
|
|
| JJPeerless wrote: | | im trying to do the dot tunnel that you see in the link i posted in my first post. |
maybe more people would look at it if you didn't post a link to a .zip (an image would be more appropriate). Until then I'm going by my assumption that you mean a simulation of a starfield like the old windows screensaver.
the reasons for using polar coordinates are twofold:
- you want the star to move further away from the center of the screen while pretty much maintaining it's angle with the center of your field of view. So you're increasing it's radius every move. You could store it in cartesian if you insist but your equation is going to basically take the cartesian coordinate, convert into the radius from the center, multiply it by a fixed ratio, then convert back to cartesian. No real difference.
- you can also then make a cool rotation effect by offsetting ALL the dot's by some angle when the user presses L/R, making the whole field spin. _________________ http://th0mas.xbox-scene.com |
|
| Back to top |
|
 |
JJPeerless
Joined: 20 Jun 2005 Posts: 82
|
Posted: Wed Jul 13, 2005 5:30 am Post subject: |
|
|
yea..you got it all wrong..im not doing a starfield..
here ill post a pic..
pretty much like that.. |
|
| Back to top |
|
 |
ector
Joined: 12 May 2005 Posts: 195
|
Posted: Wed Jul 13, 2005 5:34 am Post subject: |
|
|
| You want to draw a bunch of circles offset in x/y by some suitable amount based on the circle number and time, and radius and offset scaled by somefactor*(1/distance) where distance would be the number of the circle scaled by some value. |
|
| Back to top |
|
 |
JJPeerless
Joined: 20 Jun 2005 Posts: 82
|
Posted: Wed Jul 13, 2005 5:43 am Post subject: |
|
|
| so i have to keep track of the x,y,radius,color of Each circle and redraw all of them each frame? |
|
| Back to top |
|
 |
chp
Joined: 23 Jun 2004 Posts: 313
|
Posted: Wed Jul 13, 2005 6:57 am Post subject: |
|
|
| Or, you pre-generate a unit-circle, load a transform that sets the position & size of each circle and let the GE render it for you. :) Then you could kick quite a few circles, among other advantages. |
|
| Back to top |
|
 |
JJPeerless
Joined: 20 Jun 2005 Posts: 82
|
Posted: Wed Jul 13, 2005 7:03 am Post subject: |
|
|
| yea...im lost. |
|
| Back to top |
|
 |
AnonymousTipster
Joined: 01 Jul 2005 Posts: 197
|
|
| Back to top |
|
 |
JJPeerless
Joined: 20 Jun 2005 Posts: 82
|
Posted: Wed Jul 13, 2005 7:44 am Post subject: |
|
|
| thanks, ill work on porting that later, gotta go out.. |
|
| Back to top |
|
 |
|