Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

DragonRuby Game Toolkit

An intuitive 2D game engine. Fast, cross-platform, tiny, hot loaded. · By DragonRuby

Setting `source_h` makes the image not get rendered

A topic by Ryan1729 created Jul 02, 2020 Views: 198
Viewing posts 1 to 1

Hi! I just started digging into Dragonruby. I'm really liking the straightforwardness of the API so far.

The first thing I wanted to do was try out some simple spritesheet-based animation. So I had a look in mygame/documentation/05-sprites.md  and found the "Sprite Sub Division / Tile" example there. But when I tried it out, with my own spritesheet, nothing got rendered to the screen. After some experimentation I found that if I don't set source_h, or I set it to `-1` like other parts of the docs suggest, then I get the all the way to the bottom edge of the image rendered, as expected. But then If I set it to a positive number like 32  then the image does not show up at all.


Here's a small code example that demonstrates the issue for me:

def tick args
  args.outputs.sprites << {
    x: 100,
    y: 100,
    w: 100,
    h: 100,
    path: "dragonruby.png",
    source_x: 0,
    source_y: 0,
    source_w: 32,
    source_h: 32
  }
end

As is, this shows a blank screen, but if I remove the source_h line, then I see part of the dragonruby logo as expected.