
-----------------------------------
atal
Sat Jun 11, 2011 11:37 am

Need help &quot;mixing&quot; 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
[/code]

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) 
[/code]

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

-----------------------------------
ProgrammingFun
Sat Jun 11, 2011 11:48 am

RE:Need help &quot;mixing&quot; 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:

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
Sat Jun 11, 2011 1:43 pm

RE:Need help &quot;mixing&quot; two of my turing codes.
-----------------------------------
since the picture doesn't change, the Pic.FileNew and Pic.Free should be outside of the loop.

-----------------------------------
ProgrammingFun
Sat Jun 11, 2011 1:56 pm

Re: RE:Need help &quot;mixing&quot; two of my turing codes.
-----------------------------------
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  :oops:

-----------------------------------
atal
Sat Jun 11, 2011 7:59 pm

Re: RE:Need help &quot;mixing&quot; two of my turing codes.
-----------------------------------
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  :oops:

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
Sat Jun 11, 2011 8:02 pm

RE:Need help &quot;mixing&quot; two of my turing codes.
-----------------------------------
Pic.FileNew should be before the loop, Pic.Free should be after.
