-
Notifications
You must be signed in to change notification settings - Fork 1
For developers
At the time I’m going to copy/paste some common question I’ve received by personal messages and mail. I hope that developers and documentation writers will find this useful.
The scroller.stage1 object encapsulate all the actions performed during the game and the image sequence but, in the game, are handled in 2 different ways.
The “scroller” subobject defines some details of the “stage tape”: the stage width and the blocks that composed the stage.
Solitude, into the “stagehandler” object that is created during stage start, takes this structure and, after cloning them (for keeping the original data in memory for another play), generates an object with “generateScroller” into the “backround” group. This object simply “unroll” the stage automatically, at given speed and draw it on the screen each “blit” phase. Since was created into the background group, that is the first rendered group, all the sprites will be drawn over that layer.
The unroller doesn’t do anything else, so, for making something happen, the same object calls that “script” portion you’ve mentioned, passing the current position of the roller and the cycle number, since the unroller can loop into a part of his image roll. That “script” part spawns enemies, change the roller speed, starts dialogurs and changes the rolling part, depending on the roller position given as argument.
That’s all: the roller draws background automatically, the “stagehandler” watch for his position and tells to the script block what to do.
Just a note: have a look to all the “scroller.xxxxxxx” calls in Solitude for better understanding how it works: you probably need to add one more sea block and define a loop.
Maps are generated using the classic “array of arrays” way, as you can see on Leave Me Alone and the Legend Of Lonliness demos.
The “asciiArtToMap” is a handy for making these maps:instead of making array of rows with numbers, you can specify array of strings. Each character or group of characters will be mapped to a number, so the result will be the same of the first method.
The first argument is the array of string, with our “ascii Art” and the second one maps one or more characters in sequence to the relative tile, so (from capman)
[[null," "], <—- means, “the null value is mapped by two spaces
[0,”||"], <—- the “0” tile is mapped to double pipes
[1,“—”], <——- “1” by double minus
etc.
“gbox.blitTilemap” can create, starting from an array of arrays and a graphic tileset, a surface with the rendered map, so giving them the result of “asciiArtToMap”… voilat! Ascii art is converted to graphics.
Long story short: akihabara ever works with array of arrays. “asciiArtToMap” creates these maps starting from array of strings.