Ashbad wrote:
Well, I'm not sure (can't test it right now), but it seems that the problem is near the end; you don't seem to draw the player (Which I assume is the 'O'?) with an X coordinate; you draw it at (11, Y). Could that be it?

The O is the player yes. The scrolling works by making the map move horizontally instead of the character.
Dumb question, but what happens if you set X to the length of the string? Do you spawn on the correct side?

I also concur that moving the map rendering to immediately after the generation, may help.
So I worked all day on this, and now it's a fully functioning scrolling map engine. It can scroll horizontally and vertically, and stops scrolling when you near the edge of the map. The advantages of this are large - One 255x99 map is worth 170+ normal sized maps, you might only even need one map for an entire game.

The disadvantages are equally large however - Unless you want an entire row in the map to be a color, you can't use color, and to use my current collision detection system, would require a whopping 25245 variables, just over twenty five thousand. I need a solution to this Dx
Well, you can't reasonably change the color problem without a new BASIC interpreter or library. However, there is a way to do collision detection from a string without many variables. All you have to do is know the current position of the player in the map and have a string containing all the block types that can or can't be moved through. Just look at the four blocks surrounding the player's position in the map by extracting them from the map string, then test if the characters exist in the other list.
I'm fuzzy on how strings work so you'll have to explain better.
Let's take a 1D map represented by the string
"--W--XW--" where X is the character, W is a wall, and -- is free walking space. With my method, you'd extract the characters on either side of the character from the map. If either of them is a W, then the character can't be allowed to advance in that direction.
I wanted to try that, but I didn't know how to do that.

Code:
'ProgramMode:RUN
1->Theta
1-><r>
2->X
2->Y
5->V
5->W
"_#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5_"->Str 1
"_#E5B5_       _#E5B5_                      _#E5B5_                                          _#E5B5_                 _#E5B5_      _#E5B5_"->Str 2
"_#E5B5_                                                   _#E5B5_                      _#E5B5__#E5B5_                      _#E5B5_"->Str 3
"_#E5B5_     _#E5B5_                  _#E5B5_                 _#E5B5_                          _#E5B5_                            _#E5B5_"->Str 4
"_#E5B5_    _#E5B5_                 _#E5B5_  _#E5B5_                                         _#E5B5_ _#E5B5_                  _#E5B5_         _#E5B5_"->Str 5
"_#E5B5_  _#E5B5_             _#E5B5_        _#E5B5_          _#E5B5_                               _#E5B5_                   _#E5B5_         _#E5B5_"->Str 6
"_#E5B5_    _#E5B5__#E5B5__#E5B5_                  _#E5B5_                                            _#E5B5_ _#E5B5__#E5B5_              _#E5B5_         -"->Str 7
"_#E5B5_                         _#E5B5__#E5B5_                                                           _#E5B5__#E5B5_          _#E5B5_"->Str 8
"_#E5B5_                          _#E5B5_                                          _#E5B5__#E5B5_                       _#E5B5_   _#E5B5_"->Str 9
"_#E5B5__#E5B5__#E5B5_                                              _#E5B5_                   _#E5B5__#E5B5__#E5B5_                           _#E5B5_"->Str 10
"_#E5B5_                      _#E5B5_                         _#E5B5_ _#E5B5__#E5B5_                                              _#E5B5_"->Str 11
"_#E5B5__#E5B5__#E5B5__#E5B5_                         _#E5B5_                                            _#E5B5_   _#E5B5_                    _#E5B5_"->Str 12
"_#E5B5__#E5B5__#E5B5__#E5B5_                         _#E5B5_                                            _#E5B5_   _#E5B5_                    _#E5B5_"->Str 13
"_#E5B5_      _#E5B5_                  _#E5B5_    _#E5B5_                                                          _#E5B5_        _#E5B5_"->Str 14
"_#E5B5__#E5B5_                     _#E5B5__#E5B5__#E5B5__#E5B5_                        _#E5B5_                  _#E5B5_                            _#E5B5_"->Str 15
"_#E5B5_    _#E5B5_  _#E5B5_                 _#E5B5_                        _#E5B5_                                     _#E5B5_      _#E5B5__#E5B5__#E5B5__#E5B5_"->Str 16
"_#E5B5_                        _#E5B5__#E5B5__#E5B5_                                          _#E5B5_                  _#E5B5_   _#E5B5_     _#E5B5_"->Str 17
"_#E5B5_    _#E5B5__#E5B5_                                              _#E5B5__#E5B5_                                            _#E5B5_"->Str 18
"_#E5B5_                         _#E5B5__#E5B5__#E5B5_ _#E5B5_         _#E5B5_             _#E5B5__#E5B5_    _#E5B5_ _#E5B5_         _#E5B5_                _#E5B5_         _#E5B5_"->Str 19
"_#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5_"->Str 20
Do
While X=X
Locate 2,2,<r>+X-1
Locate 2,3,Theta+Y-1
If Getkey=28 And Y<>2
Then X->V
Y->W
If Theta<>1 And Theta<>14
Then Theta-1->Theta
Break
IfEnd
If Theta=14 And Y=4
Then Theta-1->Theta
Break
IfEnd
Theta=1 Or Theta=14=>Y-1->Y
Break
IfEnd
If Getkey=37 And Y<>6
Then X->V
Y->W
If Theta<>1 And Theta<>14
Then Theta+1->Theta
Break
IfEnd
If Theta=1 And Y=4
Then Theta+1->Theta
Break
IfEnd
Theta=1 Or Theta=14=>Y+1->Y
Break
IfEnd
If Getkey=38 And X<>2
Then X->V
Y->W
If <r><>1 And <r><>80
Then <r>-1-><r>
Break
IfEnd
If <r>=80 And X=11
Then <r>-1-><r>
Break
IfEnd
<r>=1 Or <r>=80=>X-1->X
Break
IfEnd
If Getkey=27 And X<>20
Then X->V
Y->W
If <r><>1 And <r><>80
Then <r>+1-><r>
Break
IfEnd
If <r>=1 And X=11
Then <r>+1-><r>
Break
IfEnd
<r>=1 Or <r>=80=>X+1->X
Break
IfEnd
WhileEnd
Theta=1=>Locate 1,1,StrMid(Str 1,<r>,<r>+20)
1<=Theta And Theta<=2=>Locate 1,3-Theta,StrMid(Str 2,<r>,<r>+20)
1<=Theta And Theta<=3=>Locate 1,4-Theta,StrMid(Str 3,<r>,<r>+20)
1<=Theta And Theta<=4=>Locate 1,5-Theta,StrMid(Str 4,<r>,<r>+20)
1<=Theta And Theta<=5=>Locate 1,6-Theta,StrMid(Str 5,<r>,<r>+20)
1<=Theta And Theta<=6=>Locate 1,7-Theta,StrMid(Str 6,<r>,<r>+20)
1<=Theta And Theta<=7=>Locate 1,8-Theta,StrMid(Str 7,<r>,<r>+20)
2<=Theta And Theta<=8=>Locate 1,9-Theta,StrMid(Str 8,<r>,<r>+20)
3<=Theta And Theta<=9=>Locate 1,10-Theta,StrMid(Str 9,<r>,<r>+20)
4<=Theta And Theta<=10=>Locate 1,11-Theta,StrMid(Str 10,<r>,<r>+20)
5<=Theta And Theta<=11=>Locate 1,12-Theta,StrMid(Str 11,<r>,<r>+20)
6<=Theta And Theta<=12=>Locate 1,13-Theta,StrMid(Str 12,<r>,<r>+20)
7<=Theta And Theta<=13=>Locate 1,14-Theta,StrMid(Str 13,<r>,<r>+20)
8<=Theta And Theta<=14=>Locate 1,15-Theta,StrMid(Str 14,<r>,<r>+20)
9<=Theta And Theta<=14=>Locate 1,16-Theta,StrMid(Str 15,<r>,<r>+20)
10<=Theta And Theta<=14=>Locate 1,17-Theta,StrMid(Str 16,<r>,<r>+20)
11<=Theta And Theta<=14=>Locate 1,18-Theta,StrMid(Str 17,<r>,<r>+20)
12<=Theta And Theta<=14=>Locate 1,19-Theta,StrMid(Str 18,<r>,<r>+20)
13<=Theta And Theta<=14=>Locate 1,20-Theta,StrMid(Str 19,<r>,<r>+20)
Theta=14=>Locate 1,7,StrMid(Str 20,<r>,<r>+20)
Locate V,W," "
Locate X,Y,"O"
LpWhile X=X
^^^^^ That, right there, means I need to finish getting those tokens for the Prizm, but I'd imagine most of those are already in SourceCoder. Can you run run your program through SC2 and see if the output is easier to read? Very Happy

You could probably even add a segment to your engine that defines blocks, so you can have 49x49 character blocks form one map tile, when the player goes to another the engine loads the new coords.
Today I added a randomly moving character to the center of the map. It is always moving, but of course only renders if it's on your screen.
That sounds really awesome Very Happy

I was so proud of myself when I managed to get something similar added to my scrolling map engine.
tifreak8x wrote:
That sounds really awesome Very Happy

I was so proud of myself when I managed to get something similar added to my scrolling map engine.

But it was so easy to do. Just a few bumps.
Mine was a little more complicated, but yes, it didn't really take much to do. I have mine showing which way they are facing, collision detection and also the ability to interact with the NPCs.
tifreak8x wrote:
Mine was a little more complicated, but yes, it didn't really take much to do. I have mine showing which way they are facing, collision detection and also the ability to interact with the NPCs.

You didn't need to 1-up me qq
lol, I didn't mean to D: I made those additions well over a year ago. :p
I figured a collision detection system, but it'd halve the maximum Y coord due to needing a second string for every string.
comicIDIOT wrote:
^^^^^ That, right there, means I need to finish getting those tokens for the Prizm, but I'd imagine most of those are already in SourceCoder. Can you run run your program through SC2 and see if the output is easier to read? Very Happy
^Seconded. If SourceCoder refuses, please let me know which token sequences it says it doesn't know.[/quote]
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement