classes, better debugging and spritesheets
This commit is contained in:
parent
24b94f4a59
commit
1e299dfa84
8 changed files with 660 additions and 62 deletions
0
games/map.json
Normal file
0
games/map.json
Normal file
|
@ -3,26 +3,36 @@ NAME = "Test"
|
|||
AUTHOR = "Tarion"
|
||||
VERSION = 0
|
||||
|
||||
local test = 0
|
||||
local delay = 0
|
||||
|
||||
local last = ""
|
||||
|
||||
local backgroundColor = Color(48, 104, 20, 255)
|
||||
function Load()
|
||||
SetBackgroundColor(backgroundColor)
|
||||
end
|
||||
|
||||
function Update(dt, curTime)
|
||||
end
|
||||
|
||||
local sprite = Sprite("testSprites.png")
|
||||
local sprite = Spritesheet("testSprites.json", 16, 16, Color(48, 104, 80, 255))
|
||||
local testSound = Sound("testSound.mp3", "static")
|
||||
local test = 1
|
||||
function KeyPressed(key)
|
||||
if (key == "f5") then
|
||||
if (key == "f3") then
|
||||
test = test - 1
|
||||
|
||||
if (test == 0) then
|
||||
test = sprite.Count
|
||||
end
|
||||
elseif (key == "f4") then
|
||||
test = test + 1
|
||||
sprite = Sprite("testSprites.png")
|
||||
|
||||
if (test == sprite.Count + 1) then
|
||||
test = 1
|
||||
end
|
||||
elseif (key == "f2") then
|
||||
testSound:Play()
|
||||
end
|
||||
end
|
||||
|
||||
function Draw()
|
||||
print("Loaded Sprites: " .. test, 10, 10)
|
||||
sprite:Draw(100, 0)
|
||||
DrawText(test .. "/" .. sprite.Count, 25, 25)
|
||||
sprite:Draw(test, 50, 0)
|
||||
end
|
||||
|
|
BIN
games/testSound.mp3
Normal file
BIN
games/testSound.mp3
Normal file
Binary file not shown.
18
games/testSprites.json
Normal file
18
games/testSprites.json
Normal file
|
@ -0,0 +1,18 @@
|
|||
[
|
||||
{
|
||||
"image": "testSprites.png"
|
||||
},
|
||||
{"x":0,"y":0,"width":64,"height":24},
|
||||
{"x":64,"y":0,"width":16,"height":24},
|
||||
{"x":64,"y":0,"width":16,"height":24},
|
||||
{"x":0,"y":24,"width":64,"height":24},
|
||||
{"x":80,"y":52,"width":8,"height":12},
|
||||
{"x":80,"y":68,"width":8,"height":12},
|
||||
{"x":0,"y":72,"width":80,"height":24},
|
||||
{"x":90,"y":48,"width":14,"height":48},
|
||||
{"x":72,"y":96,"width":32,"height":15},
|
||||
{"x":32,"y":96,"width":40,"height":15},
|
||||
{"x":24,"y":96,"width":8,"height":8},
|
||||
{"x":16,"y":96,"width":8,"height":8},
|
||||
{"x":16,"y":104,"width":8,"height":8},
|
||||
{"x":0,"y":96,"width":16,"height":16},{"x":0,"y":112,"width":32,"height":24},{"x":32,"y":111,"width":32,"height":24},{"x":72,"y":136,"width":32,"height":24}]
|
BIN
games/tileset.png
Normal file
BIN
games/tileset.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Loading…
Add table
Add a link
Reference in a new issue