-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
main: WIP runner game lib: add support for 32-bit BMP images
- Loading branch information
Showing
14 changed files
with
119 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", | ||
"workspace.library": ["sdk/addons/lualilka"], | ||
"workspace.library": ["sdk/addons/lualilka/library"], | ||
"runtime.version": "Lua 5.4", | ||
"hint.enable": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Player = { | ||
x = 2, | ||
y = 3, | ||
} | ||
|
||
function Player:new(o) | ||
o = o or {} | ||
setmetatable(o, self) | ||
self.__index = self | ||
return o | ||
end | ||
|
||
function Player:move(dx, dy) | ||
self.x = self.x + dx | ||
self.y = self.y + dy | ||
end | ||
|
||
-- local player = Player:new({}) | ||
|
||
Player:move(1, 1) | ||
|
||
-- print(player.x) | ||
-- player:move(1, 1) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
-- Character sprites by https://laredgames.itch.io/coins-free | ||
|
||
local WHITE = display.color565(255, 255, 255) | ||
local BLACK = display.color565(0, 0, 0) | ||
|
||
local ROOT = 'runner/' | ||
|
||
local Player = { | ||
x = 0, | ||
y = 0, | ||
width = 32, -- Розмір спрайту - 32x32 | ||
height = 32, | ||
sprites = { | ||
-- stand = { resources.load_bitmap(ROOT .. "boy_stand.bmp") }, | ||
stand = { resources.load_bitmap("face.bmp", BLACK) }, | ||
run = { | ||
resources.load_bitmap(ROOT .. "boy_run_1.bmp", BLACK), | ||
resources.load_bitmap(ROOT .. "boy_run_2.bmp", BLACK), | ||
resources.load_bitmap(ROOT .. "boy_run_3.bmp", BLACK), | ||
}, | ||
}, | ||
} | ||
|
||
function Player:new(o) | ||
o = o or {} | ||
setmetatable(o, self) | ||
self.__index = self | ||
return o | ||
end | ||
|
||
function Player:draw() | ||
-- Малюємо гравця на екрані так, щоб середина нижнього краю спрайту була в координатах (x, y) | ||
display.draw_bitmap(self.sprites.run[1], self.x - self.width / 2, self.y - self.height) | ||
end | ||
|
||
local player = Player:new({ x = 128, y = 128 }) | ||
|
||
-- display.fill_screen(WHITE) | ||
-- display.draw_bitmap(sprites.run[1], 128, 128) | ||
-- display.render() | ||
-- util.delay(1) | ||
|
||
-- display.fill_screen(WHITE) | ||
-- display.render() | ||
-- util.delay(1) | ||
-- display.fill_screen(BLACK) | ||
-- display.render() | ||
-- util.delay(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters