Computer Science Canada

I need help making a star animation as my background for my eclipse

Author:  xSeasonx [ Thu Jan 06, 2011 5:40 pm ]
Post subject:  I need help making a star animation as my background for my eclipse

What is it you are trying to achieve?
I want to make a star animated background for my eclipse


What is the problem you are having?
i dont know what codes are needed to make one


Describe what you have tried to solve this problem
i found a similiar post on this forum for a rain animation , but the codes were too hard for me to understand


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
none

Turing:


please see attachment



Please specify what version of Turing you are using
Version 4.1

Author:  Tony [ Thu Jan 06, 2011 5:44 pm ]
Post subject:  RE:I need help making a star animation as my background for my eclipse

You can use Draw.FillStar

Author:  xSeasonx [ Thu Jan 06, 2011 7:45 pm ]
Post subject:  RE:I need help making a star animation as my background for my eclipse

@ tony, what if i dont want to make a star , but i want lots of small stars in the background, so i use a code like randint?

Author:  Tony [ Thu Jan 06, 2011 8:17 pm ]
Post subject:  RE:I need help making a star animation as my background for my eclipse

Rand.Int would be a better choice, but yes.

Author:  xSeasonx [ Thu Jan 06, 2011 8:41 pm ]
Post subject:  RE:I need help making a star animation as my background for my eclipse

how can i apply that to my code with stars?

Author:  xSeasonx [ Thu Jan 06, 2011 8:44 pm ]
Post subject:  RE:I need help making a star animation as my background for my eclipse

okay forget about the stars animation.
i have a star picture in .bmp
and i attempted to ... just look at this and tell me what i did wrong... dont know how to explain.

setscreen ("graphics:800;600")
View.Set ("offscreenonly")
var mypic : int := Pic.FileNew ("stars.bmp")
var x : int := 100
var t : real := 0

Pic.Draw (mypic, maxx div 220, maxy div 220, 0)
Pic.Free (mypic)
loop
drawfilloval (400, 300, 100, 100, yellow)
drawfilloval (x, 300, 100, 100, black)
x := x + 1
View.Update
cls
delay (43)
t += 43
exit when x = 800
end loop

Author:  xSeasonx [ Thu Jan 06, 2011 8:45 pm ]
Post subject:  RE:I need help making a star animation as my background for my eclipse

but it comes out to that no picture was shown , and only said pic was freed.

Author:  DemonWasp [ Thu Jan 06, 2011 9:31 pm ]
Post subject:  RE:I need help making a star animation as my background for my eclipse

You draw the picture, then two ovals. That is pushed to the screen.

A couple milliseconds later, you clear the screen, draw two ovals, and show them on the screen.

You then repeat step 2 some 700 or so times more.


Now, can YOU tell me why the picture "isn't drawn"?


When you're drawing things in Turing, imagine that you have a chalkboard. Whatever you draw will draw over whatever was there when you drew it. This includes the "erase everything" or cls - everything is erased, not just what you want.

To fix the problem:
1. Move the call to Pic.Free() to when you are DONE with the image: after the end of the loop.
2. Move the call to Pic.Draw() to be drawn at each frame. Whether you draw it before or after the ovals is up to you, but it should be either immediately before or immediately after.

Author:  Tony [ Thu Jan 06, 2011 9:32 pm ]
Post subject:  RE:I need help making a star animation as my background for my eclipse

cls will clear the screen, including pictures from files.

Author:  xSeasonx [ Fri Jan 07, 2011 5:01 pm ]
Post subject:  RE:I need help making a star animation as my background for my eclipse

thanks guys , i managed to get the background working. but to get more advance , how can i make a background black with moving stars?
im just curious.

Author:  Tony [ Fri Jan 07, 2011 5:06 pm ]
Post subject:  RE:I need help making a star animation as my background for my eclipse

In a loop, you draw a black box that covers the background and then you draw the stars that are slightly off to the side from where they were before. This is how you animate things -- you draw them at different locations along the path.

Author:  xSeasonx [ Fri Jan 07, 2011 5:14 pm ]
Post subject:  RE:I need help making a star animation as my background for my eclipse

that seems interesting but its quite hard for my knowledge that i have and quite lazy Smile
thanks for your help anyways. +1000 xD


: