VBGamer |
|
Another thing to try... Rag on a Stick (0 replies, 0 views) (2000-Aug-30) One time back in QBasic days, I was making some game and the enemies would be attracted to you as if you had a strong gravitational pull, sometimes, they would go in perfect circles around you, so if you did some code similar to this:
Function Circle(CentreX as Single, CentreY as Single, Radius As Single)
Dim XSpeed as Single
Dim YSpeed as Single
Dim X as Single
Dim Y as Single
x = CentreX
y = CentreY - Radius
XSpeed = Sqr(Radius) 'This line will probably need some fine tuning
YSpeed = 0
Do
DrawDot x, y
x = x + XSpeed
y = y + YSpeed
XSpeed = XSpeed - Sgn(X - CentreX)
YSpeed = YSpeed - Sgn(Y - CentreY)
Loop
That is *very* rough code, and won't actually stop drawing unless you put in a stopping thing to see if it is drawing to a square it has already drawn to.
And, because I'm so tired, the 3rd last and 2nd last lines may be doing the opposite of what they are supposed to do, I can't be bothered to think, just replace the first '-' with a '+'
Yeah.
And the:
XSpeed = Sqr(Radius)
line will probably need to be changed, there may not even be a need for a sqr, it could just be dividing it by some number, but since I'm a stupid git, I can't be bothered to work it out.
That thing Corre said is probably better than this way, but I like the sound of my voice... fingers on the keyboard =)
Yeah |