|
-
Dec 14th, 2000, 01:37 PM
#1
Thread Starter
Hyperactive Member
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
-
Dec 15th, 2000, 02:43 AM
#2
transcendental analytic
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.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|