Howdy, Stranger!

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

I have a problem

edited January 2012 in General Posts: 49

I have a problem with the rotation of an image look: for example let's say that I want to do q a helm appears on the screen and that when it turns the ipad is turned then if I put this code:

--Not sigh nothing in setup but I put it
function setup()
end
function draw()
background(255,255,255,255)
GravityX = -Gravity.x * 50
rotate(GravityX)
--Let's do of account that this is a helm
sprite("Tyran Remastered:Boss A",0,0)
end
--This one is the end of the code

In this example it was not opening problem the problem would come I spread we wanted to change the position of the helm example:

function setup()
end
function draw()
background(255,255,255,255)
GravityX = -Gravity.x * 50
rotate(GravityX)
--Let's do of account that this is a helm
sprite("Tyran Remastered:Boss A",300,500)
end
--This one is the end of the code

Then that it might do?

Tagged:

Comments

  • Excuse that it was working out so disorganized it is that I did not know since organisarlo

  • SimeonSimeon Admin Mod
    Posts: 5,013

    I'm not sure if this is what you want. But this code makes a sprite that always points down based on Gravity:

    -- Lock this project to PORTRAIT orientation
    supportedOrientations(PORTRAIT)
    
    function setup()
    end
    
    function draw()
        background(40,40,50)
    
        -- Gravity as a vec2
        local g = vec2(Gravity.x, Gravity.y)
    
        -- Compute the angle between "down" and "gravity"
        local a = vec2(0, -1):angleBetween(g)
    
        -- Draw in the middle of the screen
        translate(WIDTH/2, HEIGHT/2)
    
        -- Rotate by gravity
        rotate( math.deg(a) )
    
        sprite("Small World:Tower", 0, 0)
    end
    
    
  • Ou yes thanks :-D

Sign In or Register to comment.