Very Simple Question (need help - 2D arrays)
I am currently starting a new programming project. It''s going to be a text-based meld of RTS/town simulator. Now, here''s my question.
I know how to use 2D arrays a bit, but I haven''t been able to get mine working. My reference books don''t seem to help me (mostly since my problem is with function calls).
Can I see what you all would write (very basically) for a 10x10 2D array and allow the person to move between the tiles? I''m not sure where my problem lies. I''d like to see an example of something similar to what I have so I can find out where I went wrong.
Thanks in advance.
--Samdil
Here''s some very simple tile based [pseudo-]code. It doesn''t cover loading of maps, objects on the ground, scrolling of the screen, initialization (general, or with any API), or anything seriously complex (I''m writing this with about 5 minutes of time, heh). It also doesn''t show you the best coding habits, but I''m just meaning it to get the point across:
|
Well, that''s not quite was I was looking for, since I''m just doing a VERY simple *text* game. But, I think I have it working now. I''ll post an update after I''ve finished with the adjustments.
Thanks for the help, however.
--Samdil
Thanks for the help, however.
--Samdil
Well, it works, but not the way I''d like.
If someone could post a sample to compare, that''d be great. Thanks in advance.
--Samdil
If someone could post a sample to compare, that''d be great. Thanks in advance.
--Samdil
OK, I decided to post my source so far and explain the problem.
I can get this to compile and link and execute fine, but when I move, the coords update only the Y value, and only in the positive direction. Example: start 0,0; input N - 0,1; input E - 0,2; input S - 0,3; input W - 0,4 etc.
Again this is just a simple program so far; I want to get this main part working before I expand on it. Source:
Edited by - Samdil on February 1, 2001 2:32:23 PM
I can get this to compile and link and execute fine, but when I move, the coords update only the Y value, and only in the positive direction. Example: start 0,0; input N - 0,1; input E - 0,2; input S - 0,3; input W - 0,4 etc.
Again this is just a simple program so far; I want to get this main part working before I expand on it. Source:
|
Edited by - Samdil on February 1, 2001 2:32:23 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement