Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trelemar/dome-tilekit-helper
TileKit module for DOME
https://github.com/trelemar/dome-tilekit-helper
dome wren
Last synced: 17 days ago
JSON representation
TileKit module for DOME
- Host: GitHub
- URL: https://github.com/trelemar/dome-tilekit-helper
- Owner: trelemar
- Created: 2021-10-23T19:10:27.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-25T18:24:55.000Z (about 3 years ago)
- Last Synced: 2024-12-03T14:05:44.991Z (20 days ago)
- Topics: dome, wren
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tilekit-helper
## Quickly import and process [TileKit](https://rxi.itch.io/tilekit) maps in [DOME](https://domeengine.com/)
### Example main.wren
```ruby
import "graphics" for Canvas, Color, ImageData, Point, Font
import "dome" for Process, Window, Platform
import "io" for FileSystemimport "./tilekit-helper"
var OurMap = TileMap.new("map.json")
class Main {
construct new() {}
init() {
Canvas.resize(OurMap.width * OurMap.tileWidth, OurMap.height * OurMap.tileHeight)
}
update() {}
draw(alpha) {
OurMap.draw(0, 0)
}
}
var Game = Main.new()
```## TileMap
An instance of `TileMap` class contains information about a map created with TileKit. It can be used to easily manipulate, process, and draw the map the the Canvas.### Constructors
#### `construct new(jsonfile: String)`
Creates a new instance of a TileMap object. `String` should be in same directory as this module.### Instance Fields
#### `width: Number`
Width of tilemap in tiles#### `height: Number`
Height of tilemap in tiles#### `tileWidth: Number`
Width of tiles in pixels#### `tileHeight: Number`
Height of tiles in pixels### Instance Methods
#### `getTile(x: Number, y: Number): Number`
Returns tile at map coordinates (x, y)#### `setTile(x: Number, y: Number, tile: Number)`
Sets tile at map coordinates (x, y)#### `drawTile(tile: Number, x: Number, y: Number)`
Draw a single `tile` to Canvas at (x, y)#### `drawArea(startX: Number, startY: Number, width: Number, height: Number, destX: Number, destY: Number)`
Draw a subsection of the map at (startX, startY) to (destX, destY) on Canvas#### `draw(x: Number, y: Number)`
Draws entire TileMap to Canvas at (x, y)