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

Username:   Password: 
 RegisterRegister   
 Need help "mixing" two of my turing codes.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
atal




PostPosted: Sat Jun 11, 2011 11:37 am   Post subject: Need help "mixing" two of my turing codes.

Hello,

Im new to all this programming and i have a question. For school we had to make a rocket shooting up and so i did

code:

setscreen ("graphics")
for p: 1..400
drawbox (200,p+10,250,p+100,1)
drawline (200,p+100,220,p+150,1)
drawline (250,p+100,220,p+150,1)
delay (5)
cls ()
end for


If you run it you can see that it is not very good infact no good. So i make a rocket and loaded it into turing and it show up just fine

code:

var mypic :int := Pic.FileNew ("Rocket.bmp")
Pic.Draw (mypic, maxx div 2, maxy div 2, 0)
delay (2000)
cls
Pic.Free (mypic)


How can i "mix" the two codes so that the rocket i drew flys like that boring one that i made?
Thank You in advance!


-atal



123.bmp
 Description:
Here is the Rocket. Nothing special.
 Filesize:  24.86 KB
 Viewed:  85 Time(s)

123.bmp


Sponsor
Sponsor
Sponsor
sponsor
ProgrammingFun




PostPosted: Sat Jun 11, 2011 11:48 am   Post subject: RE:Need help "mixing" two of my turing codes.

You would create a for loop again in which you increment the y axis counter so that the pic redraws and looks as if it is rising:
Turing:

for p:1..400
var mypic :int := Pic.FileNew ("Rocket.bmp")
Pic.Draw (mypic, 0, p, 0)
delay (5)
cls
Pic.Free (mypic)
end for


This solution however, would flicker so you would need to use offscreenonly, which I'll let you figure out on your own.
Tony




PostPosted: Sat Jun 11, 2011 1:43 pm   Post subject: RE:Need help "mixing" two of my turing codes.

since the picture doesn't change, the Pic.FileNew and Pic.Free should be outside of the loop.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
ProgrammingFun




PostPosted: Sat Jun 11, 2011 1:56 pm   Post subject: Re: RE:Need help "mixing" two of my turing codes.

Tony @ Sat Jun 11, 2011 1:43 pm wrote:
since the picture doesn't change, the Pic.FileNew and Pic.Free should be outside of the loop.

Oh yes...I forgot that. My bad Embarassed
atal




PostPosted: Sat Jun 11, 2011 7:59 pm   Post subject: Re: RE:Need help "mixing" two of my turing codes.

ProgrammingFun @ Sat Jun 11, 2011 1:56 pm wrote:
Tony @ Sat Jun 11, 2011 1:43 pm wrote:
since the picture doesn't change, the Pic.FileNew and Pic.Free should be outside of the loop.

Oh yes...I forgot that. My bad Embarassed


What do u mean that PicFileNew adn Pic.Free shou be outside the loop. When i do that then it does not work but when i do it like how u said at first it works.
Raknarg




PostPosted: Sat Jun 11, 2011 8:02 pm   Post subject: RE:Need help "mixing" two of my turing codes.

Pic.FileNew should be before the loop, Pic.Free should be after.
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  [ 6 Posts ]
Jump to:   


Style:  
Search: