tuxman/client/js/main.js

26 lines
520 B
JavaScript
Raw Normal View History

2023-06-13 03:47:43 +00:00
import { Sprite } from './sprite.js'
import { Map } from './map.js'
let width = 13
let height = 5
let data = [
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1,
1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1
]
let map = new Map(width, height, data)
let tux = new Sprite("/static/tux.png", map)
tux.show()
const callback = () => {
tux.add_pos(1, 0)
setTimeout(callback, 500)
}
callback()