Germanunkol / trAInsported

Löve2D Game
http://germanunkol.de/trainsported/
Other
163 stars 40 forks source link

buyTrain & direction #89

Closed PSLLSP closed 10 years ago

PSLLSP commented 10 years ago

function buyTrain(x,y,dir) has optional parameter dir. In many cases dir parameter is ignored and train is oriented like "W".

Example: buyTrain(1,1,"E")

I noticed that when a track loop directing to "S" is at location (1,1), train is always placed in "W" direction. Is this OK? The loop in (1,1) position is an interested structure. From my point of view, all train orientations should be possible in that case. Do I miss something?

https://github.com/Germanunkol/trAInsported/blob/master/Documentation.md#buytrainx-y-dir

Maybe that map from tutorial2 and position (1,1) or (5,2) or (2,3) could be used as a better example to test this issue. Loop at position (1,1) is oriented to "E".

Germanunkol commented 10 years ago

Hm, I'm not sure if this is my fault or just a misunderstanding (or bad wording on my part). The direction you give is not really the direction which the train will be facing. Instead, it's the direction in which the train will leave the current tile. So on the loop in the upper left corner of tutorial2, the only possible direction is "East".

At east that's how it should work. But I will check the code in the next few days and see if what I'm saying is really true...

Germanunkol commented 10 years ago

Yes, I've checked. The buyTrain works like intended, it may not be documented well, though. Try this in the SmallTown1 challenge:

function ai.init()
    buyTrain( 4, 4, "W" )
end

The train will leave the tile to the West (left). If you change "W" to "E" then and reload, it will leave the tile towards the east. So it's working correctly.

See the new documentation here. Is it better now?