Turing - Space Scene (Help needed)
Author |
Message |
bigone150
|
Posted: Thu Apr 23, 2009 7:24 am Post subject: Turing - Space Scene (Help needed) |
|
|
What is it you are trying to achieve?
im trying to achiece a animated space scene
What is the problem you are having?
my problem is how do i make my picture go all at once, because it glitches everytime and first the stars come then the earth and then the rocket. Also, how do i do explosion effect for the rocket?
Describe what you have tried to solve this problem
Um i tried various things to stop the glitching but none worked..
Turing: |
% black background
drawfill (1, 1, 255, 1)
% draws gray arc, max X & max Y
drawfillarc (floor (maxx / 2), 0, floor (maxx / 2), 100, 0, 180, 26)
loop
var rannum : int
for r : 1 .. 15 %(or 44)
randint (rannum, 50, 100)
drawfillstar (180 + r, 280 + r, 220 - r, 320 - r, 44)
delay (rannum )
drawfillstar (290 + r, 240 + r, 320 - r, 290 - r, 44)
delay (rannum )
drawfillstar (360 + r, 180 + r, 390 - r, 230 - r, 44)
delay (rannum )
drawfillstar (420 + r, 240 + r, 450 - r, 280 - r, 44)
delay (rannum )
drawfillstar (20 + r, 280 + r, 60 - r, 330 - r, 44)
delay (rannum )
drawfillstar (520 + r, 280 + r, 550 - r, 320 - r, 44)
delay (rannum )
drawfillstar (410 + r, 190 + r, 440 - r, 230 - r, 44)
delay (100)
drawfillstar (180 + r, 280 + r, 220 - r, 320 - r, 7)
drawfillstar (290 + r, 240 + r, 320 - r, 290 - r, 7)
drawfillstar (360 + r, 180 + r, 390 - r, 230 - r, 7)
drawfillstar (420 + r, 240 + r, 450 - r, 280 - r, 7)
drawfillstar (20 + r, 280 + r, 60 - r, 330 - r, 7)
drawfillstar (520 + r, 280 + r, 550 - r, 320 - r, 7)
drawfillstar (410 + r, 190 + r, 440 - r, 230 - r, 7)
end for
for r : 1 .. 300 by 10
drawfilloval (350 + r, 360, 30, 30, 9)
delay (150)
drawfilloval (350 + r, 360, 30, 30, 7)
delay (1)
end for
for i : 1 .. 200 by 10
drawline (80, 30 + i, 90, 50 + i, 26)
drawline (100, 30 + i, 90, 50 + i, 26)
drawline (100, 30 + i, 110, 50 + i, 26)
drawline (120, 30 + i, 110, 50 + i, 26)
drawfill (110, 40, 26, 26)
drawfillbox (80, 60 + i, 120, 150 + i, 247)
drawline (80, 150 + i, 100, 200 + i, 4)
drawline (120, 150 + i, 100, 200 + i, 4)
drawline (80, 150 + i, 120, 150 + i, 4)
drawline (80, 30 + i, 80, 60 + i, 26)
drawline (120, 60 + i, 120, 30 + i, 26)
drawline (80, 60 + i, 120, 60 + i, 26)
drawfill (100, 50 + i, 4, 26)
drawfill (100, 170 + i, 4, 4)
drawfillmapleleaf (80, 90 + i, 120, 120 + i, 12)
drawline (120, 150 + i, 120, 60 + i, 4)
drawline (80, 60 + i, 80, 150 + i, 4)
delay (100)
drawfillbox (80, 30 + i, 120, 200 + i, 255)
end for
drawfillstar (90, 360, 130, 400, 44)
drawfillarc (floor (maxx / 2), 0, floor (maxx / 2), 100, 0, 180, 26)
drawfilloval (350, 360, 30, 30, 9)
exit when hasch
end loop
|
I also would like if someone could give me ideas how to make it better? Im just a starter at Turing..
Please specify what version of Turing you are using
4.1 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Dusk Eagle
![](http://compsci.ca/v3/uploads/user_avatars/78727197549dd7290a342c.png)
|
Posted: Thu Apr 23, 2009 8:34 am Post subject: Re: Turing - Space Scene (Help needed) |
|
|
You need to stick all your code within the same for loop for your three different scenes to run simultaneously. Also, you should avoid declaring any variables within a loop, as this slows down a program significantly.
As for the explosion effect, I'll let you figure that out yourself, but you'll probably want alternating colors of red, orange, yellow, etc. |
|
|
|
|
![](images/spacer.gif) |
bigone150
|
Posted: Thu Apr 23, 2009 3:25 pm Post subject: Re: Turing - Space Scene (Help needed) |
|
|
Dusk Eagle @ Thu Apr 23, 2009 8:34 am wrote: You need to stick all your code within the same for loop for your three different scenes to run simultaneously. Also, you should avoid declaring any variables within a loop, as this slows down a program significantly.
umm what do u mean by stick all you code within the same loop? It is in the same loop.. |
|
|
|
|
![](images/spacer.gif) |
saltpro15
![](http://compsci.ca/v3/uploads/user_avatars/9776171634ced6278d14c2.png)
|
Posted: Thu Apr 23, 2009 3:26 pm Post subject: RE:Turing - Space Scene (Help needed) |
|
|
I'm confused, what does drawfill do? that's not a command, and not a procedure |
|
|
|
|
![](images/spacer.gif) |
corriep
|
Posted: Thu Apr 23, 2009 3:41 pm Post subject: Re: Turing - Space Scene (Help needed) |
|
|
drawfill |
|
|
|
|
![](images/spacer.gif) |
Dusk Eagle
![](http://compsci.ca/v3/uploads/user_avatars/78727197549dd7290a342c.png)
|
Posted: Thu Apr 23, 2009 3:45 pm Post subject: Re: Turing - Space Scene (Help needed) |
|
|
Dusk Eagle @ Thu Apr 23, 2009 9:34 am wrote: You need to stick all your code within the same for loop for your three different scenes to run simultaneously. Also, you should avoid declaring any variables within a loop, as this slows down a program significantly. See where your "for i : 1 .. whatever" 's are? These are called "for loops". The compiler will completely finish executing all the code within one "for loop" before moving on to the next. You must time all your animations so that they occur simultaneously without using multiple "for loops".
Have you looked into procedures? If you haven't, look into them here. I recommend, though this is not required, that you split each chunk of your animation into seperate procedures. Then, call the procedures from your for loop. Here is a simple start if you're interested: Turing: |
proc drawAlien (r: int)
var rannum : int := Rand.Int (50, 100)
drawfillstar (180 + r, 280 + r, 220 - r, 320 - r, 44)
delay (rannum )
drawfillstar (290 + r, 240 + r, 320 - r, 290 - r, 44)
delay (rannum )
drawfillstar (360 + r, 180 + r, 390 - r, 230 - r, 44)
delay (rannum )
drawfillstar (420 + r, 240 + r, 450 - r, 280 - r, 44)
delay (rannum )
drawfillstar (20 + r, 280 + r, 60 - r, 330 - r, 44)
delay (rannum )
drawfillstar (520 + r, 280 + r, 550 - r, 320 - r, 44)
delay (rannum )
drawfillstar (410 + r, 190 + r, 440 - r, 230 - r, 44)
delay (100)
drawfillstar (180 + r, 280 + r, 220 - r, 320 - r, 7)
drawfillstar (290 + r, 240 + r, 320 - r, 290 - r, 7)
drawfillstar (360 + r, 180 + r, 390 - r, 230 - r, 7)
drawfillstar (420 + r, 240 + r, 450 - r, 280 - r, 7)
drawfillstar (20 + r, 280 + r, 60 - r, 330 - r, 7)
drawfillstar (520 + r, 280 + r, 550 - r, 320 - r, 7)
drawfillstar (410 + r, 190 + r, 440 - r, 230 - r, 7)
end drawAlien
% black background
drawfill (1, 1, 255, 1)
% draws gray arc, max X & max Y
drawfillarc (floor (maxx / 2), 0, floor (maxx / 2), 100, 0, 180, 26)
for i : 1.. 15
drawAlien (i )
end for
|
saltpro15, to answer your question, look to the Turing Documentation:
Quote:
drawfill (x, y : int, fillColor, borderColor : int)
The drawfill procedure is used to color in a figure that is on the screen. Starting at (x, y), the figure is filled with fillColor to a surrounding border whose color is borderColor.
|
|
|
|
|
![](images/spacer.gif) |
bigone150
|
Posted: Thu Apr 23, 2009 5:54 pm Post subject: Re: Turing - Space Scene (Help needed) |
|
|
Dusk Eagle @ Thu Apr 23, 2009 3:45 pm wrote: Dusk Eagle @ Thu Apr 23, 2009 9:34 am wrote: You need to stick all your code within the same for loop for your three different scenes to run simultaneously. Also, you should avoid declaring any variables within a loop, as this slows down a program significantly. See where your "for i : 1 .. whatever" 's are? These are called "for loops". The compiler will completely finish executing all the code within one "for loop" before moving on to the next. You must time all your animations so that they occur simultaneously without using multiple "for loops".
Have you looked into procedures? If you haven't, look into them here. I recommend, though this is not required, that you split each chunk of your animation into seperate procedures. Then, call the procedures from your for loop. Here is a simple start if you're interested: Turing: |
proc drawAlien (r: int)
var rannum : int := Rand.Int (50, 100)
drawfillstar (180 + r, 280 + r, 220 - r, 320 - r, 44)
delay (rannum )
drawfillstar (290 + r, 240 + r, 320 - r, 290 - r, 44)
delay (rannum )
drawfillstar (360 + r, 180 + r, 390 - r, 230 - r, 44)
delay (rannum )
drawfillstar (420 + r, 240 + r, 450 - r, 280 - r, 44)
delay (rannum )
drawfillstar (20 + r, 280 + r, 60 - r, 330 - r, 44)
delay (rannum )
drawfillstar (520 + r, 280 + r, 550 - r, 320 - r, 44)
delay (rannum )
drawfillstar (410 + r, 190 + r, 440 - r, 230 - r, 44)
delay (100)
drawfillstar (180 + r, 280 + r, 220 - r, 320 - r, 7)
drawfillstar (290 + r, 240 + r, 320 - r, 290 - r, 7)
drawfillstar (360 + r, 180 + r, 390 - r, 230 - r, 7)
drawfillstar (420 + r, 240 + r, 450 - r, 280 - r, 7)
drawfillstar (20 + r, 280 + r, 60 - r, 330 - r, 7)
drawfillstar (520 + r, 280 + r, 550 - r, 320 - r, 7)
drawfillstar (410 + r, 190 + r, 440 - r, 230 - r, 7)
end drawAlien
% black background
drawfill (1, 1, 255, 1)
% draws gray arc, max X & max Y
drawfillarc (floor (maxx / 2), 0, floor (maxx / 2), 100, 0, 180, 26)
for i : 1.. 15
drawAlien (i )
end for
|
saltpro15, to answer your question, look to the Turing Documentation:
Quote:
drawfill (x, y : int, fillColor, borderColor : int)
The drawfill procedure is used to color in a figure that is on the screen. Starting at (x, y), the figure is filled with fillColor to a surrounding border whose color is borderColor.
Umm sorry but im totally confused.. procedure?? and whats drawalien?? and why does it disappear after it appears once i want it to go on going.. |
|
|
|
|
![](images/spacer.gif) |
Dusk Eagle
![](http://compsci.ca/v3/uploads/user_avatars/78727197549dd7290a342c.png)
|
Posted: Thu Apr 23, 2009 6:00 pm Post subject: Re: Turing - Space Scene (Help needed) |
|
|
You needed to read the link I posted above. I'll post it again here: http://compsci.ca/v3/viewtopic.php?t=14665. However, doing this is not necessary. You only need to pay attention to my first paragraph to get your code working; I am simply suggesting a better way of doing it if you are interested in learning more about programming. (And the reason it disappears after one go-through is that I didn't put a loop .. end loop around my for statement. Easy to change.) |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
bigone150
|
Posted: Thu Apr 23, 2009 6:49 pm Post subject: Re: Turing - Space Scene (Help needed) |
|
|
Dusk Eagle @ Thu Apr 23, 2009 6:00 pm wrote: You needed to read the link I posted above. I'll post it again here: http://compsci.ca/v3/viewtopic.php?t=14665. However, doing this is not necessary. You only need to pay attention to my first paragraph to get your code working; I am simply suggesting a better way of doing it if you are interested in learning more about programming. (And the reason it disappears after one go-through is that I didn't put a loop .. end loop around my for statement. Easy to change.)
Dusk Eagle, do u mind adding me on msn so there is instant communication and u can help me? Easily.. Please? |
|
|
|
|
![](images/spacer.gif) |
saltpro15
![](http://compsci.ca/v3/uploads/user_avatars/9776171634ced6278d14c2.png)
|
Posted: Thu Apr 23, 2009 7:00 pm Post subject: RE:Turing - Space Scene (Help needed) |
|
|
hmm, thanks Paul, it just seemed odd to me because usually Turing commands are darkened in black, not blue, and I didn't see him calling a procedure anywhere |
|
|
|
|
![](images/spacer.gif) |
|
|