Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 animating
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
viperfan7




PostPosted: Fri Oct 06, 2006 9:43 am   Post subject: animating

you might remember me from the huge line drawing program, I'm just wndering, how do I get a Draw.*** to move without leaving a trail and without clearing the screen, because what I want to move needs to be at the end of the program, heres the program and I'm trying to move the louds to the right all at the same speed and loop around

Quote:

View.Set ("graphics:639;479,nobuttonbar")
% NAME:viperfan7
% TITLE:NightSky
% DATE:10/5/06
% -----------------------------------------------------------------



% DESCRIPTION:
% -----------

/*
Night Sky, Ursa Major (Big Dipper) in the botom left corner
still not complete, later will add twinkaling stars effect and moving clouds
look under the right most cloud, its a shooting star
*/

% =========================
% VAR DECLARATIONS
% =========================

%Star vars
var x, y, c : int
%----------------

%star limit var
var stop : int
%-------------

%cloud vars(not in use yet, will be in use to move clouds)
var c1x,c2x,c3x : int
%----------



% ==========================
% MAIN PROGRAM
% ==========================
colourback (177)
cls



%Draws 1000 stars randomly, of random colour
stop := 0
loop
x := Rand.Int (1, maxx - 1) % Random x
y := Rand.Int (1, maxy - 1) % Random y
c := Rand.Int (1, maxcolor) % Random color
Draw.Dot (x, y, c)
stop += 1
exit when stop = 1000
end loop
%end of star draw

%draws shooting star
Draw.FillOval (500,200,2,2,111)
Draw.DashedLine (500,200,620,260,drawDashDot,111)
%end of draw shooting star

%draws Ursa Major
Draw.Line (170,150,220,120,25)
Draw.Line (220,120,300,100,25)
Draw.Line (220,120,200,80,25)
Draw.Line (200,80,250,70,25)
Draw.Line (250,70,300,100,25)
Draw.Line (140,200,170,150,25)
Draw.FillOval (140,200,5,5,0)
Draw.FillOval (170,150,5,5,0)
Draw.FillOval (220,120,5,5,0)
Draw.FillOval (200,80,5,5,0)
Draw.FillOval (250,70,5,5,0)
Draw.FillOval (300,100,5,5,0)
%end of Ursa Major draw


%draws moon
Draw.FillOval (maxx div 4,maxy div 4 * 3,60,60,23)
%draws craters on the moon
Draw.FillOval (maxx div 4,maxy div 4 * 3 - 30,5,5,22)
Draw.FillOval (maxx div 4 + 20,maxy div 4 * 3 - 30,6,6,22)
Draw.FillOval (maxx div 4 - 5,maxy div 4 * 3 - 39,3,3,22)
Draw.FillOval (maxx div 4,maxy div 4 * 3 + 39,5,5,22)
Draw.FillOval (maxx div 4 - 30,maxy div 4 * 3 - 30,5,5,22)
%end of crater draw
%makes it a quarter moon
Draw.FillOval (maxx div 4 + 30,maxy div 4 * 3,60,60,177)
%end of qurter moon draw
%end of moon draw
%draws clouds
Draw.FillOval (120,380,100,20,20)
Draw.Oval (120,380,100,20,22)
Draw.FillOval (180,350,100,20,20)
Draw.Oval (180,350,100,20,22)
Draw.FillOval (460,300,100,20,20)
Draw.Oval (460,300,100,20,22)
%end of draw clouds
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Fri Oct 06, 2006 10:34 am   Post subject: (No subject)

well... you cant move something and not leave a trail without clearing the screen... if you want your program to not flash then check out the View.Update and View.Set tutorial in the Turing Walkthrough
NikG




PostPosted: Sat Oct 07, 2006 1:29 am   Post subject: (No subject)

In your loop, just clear the screen and redraw everything, with the clouds at their new positions. Procedures are useful here.
BenLi




PostPosted: Sat Oct 07, 2006 8:49 am   Post subject: (No subject)

well the thing is to make all of your non-movable things in one procedure and your movable things in another procedure (with parameters of course) and draw them all in a loop. Now the problem with this is that your stars and sky are random so you need to take a screenshot of your program using Pic.New (consult turing documentation)

However, if the shooting star is the only movalbe things, you can just increment the shooting star, View.Update and just not followed by cls
viperfan7




PostPosted: Tue Oct 10, 2006 9:06 am   Post subject: (No subject)

kk thx for all the help, I really need to learn procedures
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: