23 lines
442 B
Plaintext
23 lines
442 B
Plaintext
|
|
||
|
delta_time = @events.delta_time()
|
||
|
|
||
|
player_sprite = @canvas.create_sprite {
|
||
|
atlas = @import("./player.bmp"),
|
||
|
viewport = @rect(0, 0, 0.1, 0.1),
|
||
|
bounds = @rect(0, 0, 0.05, 0.05)
|
||
|
}
|
||
|
|
||
|
@input.on_axis2d("move", => (axes) {
|
||
|
player_sprite.position = player_sprite.position + (axes * delta_time)
|
||
|
})
|
||
|
|
||
|
@input.on_axis2d("look", => (axes) {
|
||
|
player_sprite.rotation = @atan2(axes.y, axes.x);
|
||
|
})
|
||
|
|
||
|
return {
|
||
|
title = "Demo",
|
||
|
width = 640,
|
||
|
height = 480,
|
||
|
}
|