Last active
December 27, 2020 10:11
-
-
Save amirrajan/fc9b10bc4924b0aae73e5e3551e01349 to your computer and use it in GitHub Desktop.
DragonRuby Game Toolkit Sprite Sheet Example
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
def tick args | |
args.labels << [640, 689, "Asset Presenter", 0, 1] | |
args.sprites << tile(0, 0, 100, 100) | |
args.sprites << tile(1, 0, 200, 200) | |
args.sprites << tile(2, 0, 300, 300) | |
10.map_with_index do |x| | |
10.map_with_index do |y| | |
args.sprites << tile(x, y, 30 + x * 64, 30 + y * 64) | |
end | |
end | |
end | |
def tile ordinal_x, ordinal_y, x, y | |
[ | |
{ | |
x: x, | |
y: y, | |
w: 64, | |
h: 64, | |
path: 'sprites/sprite_sheet.png', | |
tile_x: ordinal_x * 64, | |
tile_y: ordinal_y * 32, | |
tile_w: 64, | |
tile_h: 64 | |
} | |
] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment