Sprite in Image

When I try this, The sprite gets all messed up.


where is defined screen, x and y ?

use readImage instead : http://twolivesleft.com/Codea/Reference/Storage.html#readImage

myImage = readImage("Planet Cute:Heart")

@Leviathan - setContext is meant to be used when you draw to an image in memory, not to the screen, eg

  --draw something

--then in the draw function....
sprite(img,400,200) --draw the image held in memory

I don’t think that “Documents:person” is a square. What you want to do is something like this:

img = readImage("Documents:person")
sprite(img, x, y, img.width*2, img.height*2)

We’re all interpreting your question different ways. Can you give us a bit more detail with how your sprite gets mixed up? My code above will allow you to scale a sprite.

The user and all related content has been deleted.

I got it to work both ways, thank guys! Sorry about not sending enough information. I ended up using a viewMatrix and a restMatrix. And readImage works better, because it’s not as laggy. Thanks guys!