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

Username:   Password: 
 RegisterRegister   
 Using a text File
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chaos




PostPosted: Tue Jan 04, 2011 7:09 pm   Post subject: Using a text File

I am creating a two-player shooter game. I want to create the map as a text file in Notepad and use it in Turing. I also need to locate spawn points on the map. The problem is that I do not know where to start. Where do i begin?
Sponsor
Sponsor
Sponsor
sponsor
TokenHerbz




PostPosted: Tue Jan 04, 2011 7:15 pm   Post subject: RE:Using a text File

Things you will need to know are:

2D Arrays / File Input/Output / to start. I would recommend going threw this link and also the F9 of your turing (maybe F10).
http://compsci.ca/v3/viewtopic.php?t=8808

The general idea i think you want to do is create a "number grid" in a text, then read that as a 2D array to draw into your program, using the different numbers for different types of tiles, including spawn points, paths, grass, etc, ..
chaos




PostPosted: Fri Jan 07, 2011 4:55 pm   Post subject: Re: Using a text File

how would you do this using pixel graphics?
Insectoid




PostPosted: Fri Jan 07, 2011 8:45 pm   Post subject: RE:Using a text File

You could use modulus to estimate where the character is on the ascii map.
TokenHerbz




PostPosted: Fri Jan 07, 2011 8:45 pm   Post subject: RE:Using a text File

you would just import the picture and use it to draw/move. It's also in the walkthrew and F10 in turing if you take a look..

Give it a try and i'll assist. (post your efforts)
chaos




PostPosted: Fri Jan 07, 2011 9:54 pm   Post subject: Re: Using a text File

do i create the map in Paint or some other program? When i create the map, in what format should i save it as (jpeg, bitmap, gif) ?
TokenHerbz




PostPosted: Fri Jan 07, 2011 11:12 pm   Post subject: RE:Using a text File

Well with turing i'd use bitmap even tho its like a large file, less problems arrise.

Iv'e also used paint to create images both large and small and used them with sucess.
chaos




PostPosted: Mon Jan 10, 2011 8:09 pm   Post subject: Re: Using a text File

I tried to make a map using notepad. I opened it up in Turing and the output window showed some of my map as random characters. Why does this happen?


mapB.txt
 Description:

Download
 Filename:  mapB.txt
 Filesize:  382 Bytes
 Downloaded:  114 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Jan 10, 2011 8:32 pm   Post subject: RE:Using a text File

Perhaps because you are using tabs on line 15 instead of spaces like everywhere else?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
chaos




PostPosted: Wed Jan 12, 2011 6:22 pm   Post subject: Re: Using a text File

Thanks Tony. I fixed that mistake and did some work with my problem. I can get my map drawn on the output window. The problem is that the window doesn't stay in one place. It moves down to draw more of the map which isn't there. How do I fix this?


How to make maps.t
 Description:

Download
 Filename:  How to make maps.t
 Filesize:  365 Bytes
 Downloaded:  130 Time(s)

chaos




PostPosted: Wed Jan 12, 2011 6:23 pm   Post subject: Re: Using a text File

Here is the map:


mapB.txt
 Description:

Download
 Filename:  mapB.txt
 Filesize:  257 Bytes
 Downloaded:  126 Time(s)

Tony




PostPosted: Wed Jan 12, 2011 6:54 pm   Post subject: RE:Using a text File

If you are putting too much text, the window will scroll. You can do a number of things:
- think of some checks to make sure that you are not printing too much text
- use locate to move the cursor back up
- work with graphics instead of text
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
chaos




PostPosted: Wed Jan 12, 2011 7:39 pm   Post subject: Re: Using a text File

I tried what u said and it helped. So how would i go about drawing the map and enbaling player movement while the map is still drawn?
Tony




PostPosted: Wed Jan 12, 2011 7:44 pm   Post subject: RE:Using a text File

You'd have to draw everything on the screen, every time something changes. So once the player moves, you'd have to clear the screen, draw the map again, and then the player at a new location on top of the map.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 14 Posts ]
Jump to:   


Style:  
Search: