diff --git a/flake.nix b/flake.nix index 76db40b..e3cc328 100644 --- a/flake.nix +++ b/flake.nix @@ -23,9 +23,8 @@ nativeBuildInputs = [ just lua-language-server - nushell - pixelorama playdate-sdk-pkg + tup ]; }; }; diff --git a/justfile b/justfile index 04d0f73..5ca317c 100644 --- a/justfile +++ b/justfile @@ -8,6 +8,5 @@ alias s := simu simu: build PlaydateSimulator {{ bin }} -alias pxl := pixelorama -pixelorama: - pixelorama +cook-assets: + @(which aseprite > /dev/null) || (echo "Missing aseprite program"; exit 1) diff --git a/src/img/level_01.aseprite b/src/img/level_01.aseprite new file mode 100644 index 0000000..0e0c3dc Binary files /dev/null and b/src/img/level_01.aseprite differ diff --git a/src/main.lua b/src/main.lua index 2717867..98db2ae 100644 --- a/src/main.lua +++ b/src/main.lua @@ -19,10 +19,6 @@ function gameInit() atlas = gfx.imagetable.new("img/bg_atlas") end --- Now we'll call the function above to configure our game. --- After this runs (it just runs once), nearly everything will be --- controlled by the OS calling `playdate.update()` 30 times a second. - gameInit() function playdate.update() @@ -31,17 +27,18 @@ function playdate.update() -- Note that it is possible for more than one of these directions -- to be pressed at once, if the user is pressing diagonally. + local speed = 5 if playdate.buttonIsPressed(playdate.kButtonUp) then playerSprite:moveBy(0, -2) end if playdate.buttonIsPressed(playdate.kButtonRight) then - playerSprite:moveBy(2, 0) + playerSprite:moveBy(speed, 0) end if playdate.buttonIsPressed(playdate.kButtonDown) then playerSprite:moveBy(0, 2) end if playdate.buttonIsPressed(playdate.kButtonLeft) then - playerSprite:moveBy(-2, 0) + playerSprite:moveBy(-speed, 0) end -- Call the functions below in playdate.update() to draw sprites and keep