dot tunnel
-
- Posts: 82
- Joined: Mon Jun 20, 2005 3:32 am
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.
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.
- 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.
- 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.
-
- Posts: 82
- Joined: Mon Jun 20, 2005 3:32 am
-
- Posts: 82
- Joined: Mon Jun 20, 2005 3:32 am
-
- Posts: 82
- Joined: Mon Jun 20, 2005 3:32 am
-
- Posts: 82
- Joined: Mon Jun 20, 2005 3:32 am
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.JJPeerless wrote:im trying to do the dot tunnel that you see in the link i posted in my first post.
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.
-
- Posts: 82
- Joined: Mon Jun 20, 2005 3:32 am
-
- Posts: 82
- Joined: Mon Jun 20, 2005 3:32 am
-
- Posts: 197
- Joined: Fri Jul 01, 2005 2:50 am
Just throwing this out into the open, but I think this might be what you are after:
http://www.blitzbasic.co.nz/codearcs/co ... p?code=734
The code is in basic, but shouldn't take too much porting.
Hope this helps.
http://www.blitzbasic.co.nz/codearcs/co ... p?code=734
The code is in basic, but shouldn't take too much porting.
Hope this helps.
-
- Posts: 82
- Joined: Mon Jun 20, 2005 3:32 am