-
I've been doing VB for a few years but only recently have I decided to explore VB's gaming possibilities. I need examples for the following issues to help me get started.
1.I want a function to select a point, a distance from it, and orbit a pixel around it at that distance. Similiar to the circle function.
2.I've got a small black square in the middle of my screen with lines connecting the cornors with coresponding conors of the screen to give a tunnel affect. How do I get the side walls to give the illusion of the user moving into the tunnel?
Thanks in Advance,
Joey O
-
Here's for having a point orbiting a pixel at a constant distance:
http://forums.vb-world.net/showthrea...threadid=44426
To give the illusion of moving into a tunel, with a constant speed, you probably need more walls, but for the moment and for a single wall(you can do this for all walls) is a line with two points, and each points moves away from the center of the tunnel exponentially.
How to do it is to first get the distance d to the center:
Code:
dy=(poiny-centery)
dx=(pointx-centerx)
d=sqr(dy*dy+dx*dx)
then you offset the pixel by a constant fraction of the distance, which is called speed:
Code:
pointy=pointy+(pointy-centery)*speed
pointx=pointx+(pointx-centerx)*speed
note that speed has to be a very small fraction, for instance 0.02 to give a realistic effect.
Now you repeat this for both points in all lines, and then repeat everything and you have a tunnel animation.