Author |
Message |
chaos
|
Posted: 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
|
|
|
TokenHerbz
|
Posted: 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
|
Posted: Fri Jan 07, 2011 4:55 pm Post subject: Re: Using a text File |
|
|
how would you do this using pixel graphics?
|
|
|
|
|
|
Insectoid
|
Posted: 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
|
Posted: 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
|
Posted: 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
|
Posted: 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
|
Posted: 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?
Description: |
|
Download |
Filename: |
mapB.txt |
Filesize: |
382 Bytes |
Downloaded: |
114 Time(s) |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: 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?
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
chaos
|
Posted: 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?
Description: |
|
Download |
Filename: |
How to make maps.t |
Filesize: |
365 Bytes |
Downloaded: |
130 Time(s) |
|
|
|
|
|
|
chaos
|
Posted: Wed Jan 12, 2011 6:23 pm Post subject: Re: Using a text File |
|
|
Here is the map:
Description: |
|
Download |
Filename: |
mapB.txt |
Filesize: |
257 Bytes |
Downloaded: |
126 Time(s) |
|
|
|
|
|
|
Tony
|
Posted: 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
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
chaos
|
Posted: 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
|
Posted: 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.
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|