Computer Science Canada

Raeding and Writing to a File

Author:  ¿§¥JÃ¥mës¥§¿ [ Fri Oct 10, 2003 1:19 pm ]
Post subject:  Raeding and Writing to a File

IN the totorials section there is a reading and writing thig but it is an extention where is the first one??

Author:  hackman [ Fri Oct 10, 2003 4:05 pm ]
Post subject: 

I think this is what your looking for

http://www.compsci.ca/v2/viewtopic.php?t=5

Author:  ¿§¥JÃ¥mës¥§¿ [ Fri Oct 10, 2003 8:47 pm ]
Post subject: 

Yup thats the one! Laughing Thanx

Author:  Blade [ Sat Oct 11, 2003 12:19 am ]
Post subject: 

up at the top there's a search button... click that then you can search the tutorials section for 'reading and writing files'

Author:  ¿§¥JÃ¥mës¥§¿ [ Mon Oct 13, 2003 4:58 pm ]
Post subject: 

That search buttun is handy thatnx Laughing but I have a question bout it. How do you store a pisture to a file?

Author:  AsianSensation [ Mon Oct 13, 2003 6:50 pm ]
Post subject: 

a picture to a textfile?

um.......

well, you can use whatdotcolor to store what color each pixel of the picture is, then store those values in a textfile. When you want redraw the picture, use drawdot to draw each single pixel, and Pic.Save or Pic.ScreenSave to save the picture to a newfile...

But whatdotcolor is really slow, especially if you have to use it in 2 for loops to get every single pixel of a large picture.

Author:  Tony [ Mon Oct 13, 2003 8:15 pm ]
Post subject: 

just save the picture as a .bmp Rolling Eyes

code:

Pic.ScreenSave (x1, y1, x2, y2 : int, fileName : string)

Author:  ¿§¥JÃ¥mës¥§¿ [ Mon Oct 13, 2003 8:39 pm ]
Post subject: 

Aw yes thats the ticket 8) thanx tony Very Happy

Author:  AsianSensation [ Mon Oct 13, 2003 10:24 pm ]
Post subject: 

ah.........just a file, should have told me, now you forced me to fill your head with all these junk about whatdotcolor that you should never use, just because it's so slow. Very Happy

Author:  ¿§¥JÃ¥mës¥§¿ [ Tue Oct 14, 2003 11:41 am ]
Post subject: 

ok I got another question. I'm kinda confused on the Pic.ScreenSve thing.
You wrote
Quote:
Pic.ScreenSave (x1, y1, x2, y2 : int, fileName : string)
So I got the basic consept but where do you specify witch picture you want saved??

I'll give you the problem that I'm trying to do so maybe you could tell me if there is a better way or if I'm just way off. I'm trying to make a random back ground for a horizantal space shooter kinda thing. so I can make the background come but I have to make the space ship move so I have to clear the sceen and the background disapears. So my idea was to save the background that I have just made to a file so I can keep redrawing it. Got any ideas??

Author:  naoki [ Tue Oct 14, 2003 4:53 pm ]
Post subject: 

you could do what my partner and i did:

take a picture the size of your game window and duplicate it so there's 2 of the same. then position the pictures beside each other and make a program to slide them to the left to give the appearance of movement. when one picture is all the way off the viewable screen it reloads its position right beside the 2nd picture

Author:  Tony [ Tue Oct 14, 2003 8:22 pm ]
Post subject: 

Pic.ScreenSave saves the picture on the screen between xy1 and xy2 into a bmp file name specified.

I think you can use Pic.Save to save already existing picture from a pointer (Pic.New)

as for the game... you might want to create a datafile and then just use a tile system to recreate it.


: