Howdy, Stranger!

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

Sprite in Image

edited July 2014 in Questions Posts: 22

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

setContext(screen)
sprite("Documents:person",x,y,WIDTH*2,HEIGHT*2)
setContext()

Comments

  • where is defined screen, x and y ?

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

    myImage = readImage("Planet Cute:Heart")

  • IgnatzIgnatz Mod
    edited July 2014 Posts: 5,396

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

    img=image(200,300)
    setContext(img)
      --draw something
    setContext()
    
    --then in the draw function....
    sprite(img,400,200) --draw the image held in memory
    
  • Posts: 2,820

    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.
  • Posts: 22

    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!

Sign In or Register to comment.