Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Some help with map movement please

Author
Message
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 4th Nov 2012 18:03
This is a text map.This is the code I have so far. I am not sure how to work out the movement. The player should be able to move north and south up and down the street. If the player is in the middle of the map facing north and turns right(east) he should be facing one of the buildings if he turns left(West) he will get a message that he can;t go that way. Same for the very top and bottom of map. If he is facing a building I will give him options. Enter bldg, face north, face south etc... if he enters bldg. he will have other options. I think I can work that out, it is just the actual movement I am stuck on. I am also thinking about using the arrow keys for movement and maybe even changing to a 3D map depending on the answer to the question below the code snippet. For some reason I have it in my head to do some text stuff before moving on, don't know why!



I have one more question. This is a text map so all of this has to be coded?

I see it like this the player moves across the terrain by the arrow keys, movement keys or mouse sees a bldg enters it then gets the game options for that bldg does whatever needs to be done and moves on so in a way I am thinking 3D may be easier in some ways.

THANKS FOR ANY HELP OR ADVICE!!!
Dragonslayer
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 5th Nov 2012 22:28
Unfortunately the way you are storing your locations doesn't hold any reference as to where they are located. You could potentially organise it more like this:



This then gives you a 2d grid representing your map with the number at each grid reference being a lookup against the location list to see what is there. For instace, the '2' at (zero-indexed) grid reference [1, 4] represents 'My house' from the locations list. The grid also shows that 'My house' is between 'a rock' and 'a hard place' and there is a 'path' from it to 'the castle'.

If that isn't making sense then let me know and I'll try and get an example together for you when I get some time.


Previously TEH_CODERER.
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 6th Nov 2012 02:24
Andrew

This does make sense I will do it when I get more time, probably tomorrow then I have to work out movement. This is just practice for me to learn this stuff.

I looked at someones code today and thought, I will never be able to do that and wanted to give up the whole programming idea and switch over to FPSC but that would only last a couple of days and I would be back here trying to figure things out!

Dragonslayer
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 6th Nov 2012 03:20
Programming takes longer than a day to learn. Some of us have been at this for more than 10 years and still learn new things.

"You're not going crazy. You're going sane in a crazy world!" ~Tick
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 6th Nov 2012 04:27
Yes I know this. I have played around with it a little in past years but never really got serious until about 2 months ago.
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 6th Nov 2012 22:37
Quote: "Programming takes longer than a day to learn. Some of us have been at this for more than 10 years and still learn new things.
"


yup! me is one of them

Advanced Updater for your games!
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 6th Nov 2012 22:43
I did this real quick, I have to run out for a little while. This is what I did. It is not right, I get an error that says can not determine locations at line 10. I have some Rem statements before this code.

Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 7th Nov 2012 00:52
How about this as a quick example?



Let me know if any of it doesn't make sense or have any other questions. I hope it helps a bit!


Previously TEH_CODERER.
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 7th Nov 2012 01:42
I just got home and gave this a quick look. I do get some of it but will go through it line by line to make better sense of it. That is quite a bit of code! Bet you did this right off the top of your head!!!

I know you can't learn this in a day, I am still trying to figure out how to learn. What is the best way to learn it. It is just no fun with my nose stuck in a book most of the time and then make a stupid little program that really means nothing. Thanks a lot for this example!

Dragonslayer
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 7th Nov 2012 02:01
I would like to know this, there is a line of code and I have seen this before.

color backdrop 0x212121

I know using numbers like 123,75,101 with ink,rgb commands can get you a pretty good range of colors but 0x212121 i am guessing is a color number. where do you come up with that number? I saw something about using numbers like this and I don't remember where!
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 7th Nov 2012 07:03
0x means its a hexadecimal number. The other digits represent red, green, blue like this: RRGGBB. If you've ever done HTML, it should look familiar. In hex, FF means 255.

rgb(64, 128, 192) is the same as 0x4080C0

"You're not going crazy. You're going sane in a crazy world!" ~Tick
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 7th Nov 2012 18:40
Quote: "That is quite a bit of code! Bet you did this right off the top of your head!!!"


I did, but I've been programming now since I was 12, and I'm still learning all the time.

Quote: "color backdrop 0x212121"


Sorry about that one. I'm a web developer by trade and it was just a force of habit. There is no real reason to write colours that way, I'm just so used to it now that I can pretty much come with a hex value for whatever colour I'm after as almost second nature. The only plus side to it over using the 'rgb' function is that you can include an alpha value (e.g. 0xaaffffff would be a part way transparent white colour).

Anyway, once you've taken a proper look through, just let me know if I can be of any more help.


Previously TEH_CODERER.
Mdj
14
Years of Service
User Offline
Joined: 11th Mar 2012
Location: The Shire
Posted: 28th Jan 2013 02:19
Shout out to Andrew for his last post with code. Nice example. I haven't attempted to run it yet.
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 28th Jan 2013 18:58
Thanks, I hope it proves helpful. Let me know if I can help explain or expand on any part of it.


Previously TEH_CODERER.
Mdj
14
Years of Service
User Offline
Joined: 11th Mar 2012
Location: The Shire
Posted: 30th Jan 2013 21:47
Thanks. It looks much like text adventures I used to type in on the Atari back in the day.

Login to post a reply

Server time is: 2026-07-07 02:16:35
Your offset time is: 2026-07-07 02:16:35