Log In  

For my Pebble Dash game im using the sprite editor to actually make levels (I then use peek() to get the data and construct the map).

I thought about using those sprites as map previews in the game.

I had the map displayed properly using spr(), but thought it was to small and wanted to scale them up a little bit using sspr(). So I'm rescaling the proper 16x16 area from the sprite sheet to 32x32 on the screen.

But some "artifacts" appeared.

I thought the "engine" would use nearest neighbour? And nothing should change much since it's a simple 2x upscale? If that's not the case, is there any way around it?

P#10309 2015-04-29 08:26 ( Edited 2015-04-29 19:29)

This is quite a curious glitch. I wasn't able to replicate it here, I wonder if there's some context to it.
As a workaround, you could poke the pixels directly into the screen similar to how you read the levels using peek.
Here's a function that draws a part of spritesheet upscaled x2:

function sspr2x(sx,sy,sw,sh,dx,dy)
 local px,ac,ad
 ac=0x6000+dy*64+shr(dx,1)
 for y=0,sh-1 do
  ad=ac+y*128
  for x=0,sw-1 do
   px=sget(sx+x,sy+y)
   px+=shl(px,4)
   poke(ad,px)
   poke(ad+64,px)
   ad+=1
  end
 end
end

Note that this will always snap the drawn graphic to an even x-coordinate since those are stored as pairs. Otherwise should be totally sufficient for your purposes:

function _draw()
 cls()
 sspr2x(32,64,16,16,48,56)
 sspr(32,64,16,16,48,56-32,32,32)
end
P#10314 2015-04-29 11:56 ( Edited 2015-04-29 15:57)

It was my fault... I forgot that black is transparent... I still had the old mini-preview in the middle, with the larger one drawn on top of it... Silly me :P Those "artifacts" were the small preview visible through transparent bits of the larger one.

P#10328 2015-04-29 13:51 ( Edited 2015-04-29 17:51)

Note there are still two bugs in sspr though (both will be fixed in 0.1.1):

  • flip parameter has no effect
  • drawing with negative width or height has no effect (this should be an alternative method to flip horizontally and also vertically)
P#10332 2015-04-29 15:29 ( Edited 2015-04-29 19:30)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 12:45:09 | 0.007s | Q:15