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

Username:   Password: 
 RegisterRegister   
 I need help making a star animation as my background for my eclipse
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
xSeasonx




PostPosted: 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



Eclipse.t
 Description:

Download
 Filename:  Eclipse.t
 Filesize:  411 Bytes
 Downloaded:  260 Time(s)


Eclipse.t
 Description:
Here is my eclipse.

Download
 Filename:  Eclipse.t
 Filesize:  411 Bytes
 Downloaded:  200 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
xSeasonx




PostPosted: 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?
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
xSeasonx




PostPosted: 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?
xSeasonx




PostPosted: 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
xSeasonx




PostPosted: 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.
DemonWasp




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
xSeasonx




PostPosted: 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.
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
xSeasonx




PostPosted: 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
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  [ 12 Posts ]
Jump to:   


Style:  
Search: