26 lines
520 B
JavaScript
26 lines
520 B
JavaScript
|
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()
|