Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

background sprite loads stretched

edited March 2013 in General Posts: 127

Hello guys, first post and quite a novice on codea/lua coding.
Here's my problem : I'm planning to make a background sprite to scroll from right to left ( as in most of horizontal 2d shooters ). The sprite scrolls fine, but the image loaded looks blurred as it was stretched.

the image, as saved from photoshop is sized 3372x650 and it doesn't look any stretched or blurred
( the file can be downloaded from https://mega.co.nz/#!KQ8SUaSC!Wsx8hGfs1BEOEEm5RxZNcjAPlTJVfk2kYKEmI2BWFaU )
the background class looks like :

bg = class()

function bg:init(x,y)

self.x = x
self.y = y
bg1 = ("documents:bg1",self.x,self.y,3372,650)
end

function bg:draw()

sprite(bg1,self.x,self.y,3372,650)

end

and recalled in the main class as below :
function setup()

bg1 = bg(1600,400)

cnt = 0

end

function draw()

cnt = cnt +1

if (cnt==4) then

1bg.x = 1bg.x - 1

end

bg1:draw()

end

Comments

  • IgnatzIgnatz Mod
    Posts: 5,396

    Have you changed the x:y ratio (3372:650<>1600:400) ?

  • Posts: 127

    1600,400 is the bg sprite initial position, did I write it wrong? ( as this is not as taken from codea, and currently writing from mac, not ipad :D )

Sign In or Register to comment.