Chopy Lines
Author |
Message |
Lucas
|
Posted: Tue Apr 12, 2011 9:19 pm Post subject: Chopy Lines |
|
|
What is it you are trying to achieve?
When i say to draw the line, Im just drawing from one point to the next point, then so on, but the values of the points seem to change, or at least thats what i think, since noone of the points actually touch, and its all choppy. so im just wondering why this is happening and is there a way to make it smooth?
Turing: |
View.Set ("graphics: 800; 800, offscreenonly")
type data :
record
x, y, dix, diy : real
count, num : int
end record
var points : array 1 .. 720 of data
var t : real := 0
var numpoints : int := 180
for a : 1 .. numpoints
points (a ).x := maxx div 2
points (a ).y := maxy div 2
points (a ).dix := 0
points (a ).diy := 0
points (a ).count := a
points (a ).num := a
end for
colorback (black)
loop
t + = 2
for a : 1 .. numpoints
points (a ).count - = 1
if points (a ).count < 0 then
points (a ).x := maxx div 2
points (a ).y := maxy div 2
points (a ).dix := sind (t ) * 4
points (a ).diy := cosd (t ) * 4
points (a ).count := numpoints
end if
points (a ).x + = points (a ).dix
points (a ).y + = points (a ).diy
if points (a ).x > maxx or points (a ).x < 0 then
points (a ).dix := -points (a ).dix
end if
if points (a ).y > maxy or points (a ).y < 0 then
points (a ).diy := -points (a ).diy
end if
if points (a ).num not= numpoints then
Draw.Line (points (points (a ).num ).x div 1, points (points (a ).num ).y div 1, points (points (a + 1).num ).x div 1, points (points (a + 1).num ).y div 1, white)
end if
Draw.Line (points (points (numpoints ).num ).x div 1, points (points (numpoints ).num ).y div 1, points (points (1).num ).x div 1, points (points (1).num ).y div 1, white)
end for
View.Update
delay (5)
cls
end loop
|
Please specify what version of Turing you are using
4.1.1 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Zren
|
Posted: Tue Apr 12, 2011 11:12 pm Post subject: RE:Chopy Lines |
|
|
Perhaps because you're calculating movement and rendering at the same time.
You're rendering a line to the next point before it's moved for that frame. Get in the habit of breaking up logic and drawing processes.
loop
resetSelectedPoints
movePoints
renderLines
end loop |
|
|
|
|
|
Lucas
|
Posted: Wed Apr 13, 2011 5:16 pm Post subject: RE:Chopy Lines |
|
|
aaahhhh okay thx |
|
|
|
|
|
|
|