help with coordinates

Hello! I am a newbie that recently purchased codea. I really like this app and though I don’t know programming it’s easy for me to understand it. But I have a question which I think is already very long. Below is the code, which presents the opportunity to move from one page to another. the transition is by clicking on the cube. could you help me set up the right coordinates to the second page. Many thanks in advance!

function setup()
    gameMode = Str1
end

function draw()
    background(40, 40, 50)
    gameMode()
    strokeWidth(5)
end

function Str1()
    background(255, 255, 255, 255)
    sprite("Platformer Art:Block Grass", WIDTH/2, 384)
    font("Baskerville-BoldItalic")
    fill(0, 0, 0, 255)
    text("1", WIDTH/2, HEIGHT/2.4)
end

function Str2()
    background(255, 255, 255, 255)
    sprite("Platformer Art:Block Brick", WIDTH/1.5, 384)   
    font("Baskerville-BoldItalic")
    fill(0, 0, 0, 255)
    text("2", WIDTH/2, HEIGHT/2.4)
end

function Str3()
    background(255, 255, 255, 255)
    sprite("Planet Cute:Dirt Block", WIDTH/2, 384)   
    font("Baskerville-BoldItalic")
    fill(0, 0, 0, 255)
    text("3", WIDTH/2, HEIGHT/2.4)
end

function touched(t)

if gameMode == Str1 then
    if t.x>WIDTH/2-50 and t.x<WIDTH/2+50 and t.y>350 and t.y<450 and t.state == ENDED then
--music("Dropbox:Test")
        gameMode = Str2
    end
end
if gameMode == Str2 then
        --    ||
        --    ||
        --    \\/
    if t.x>WIDTH/2+50 and t.x<WIDTH/2-50 and t.y>350 and t.y<450 and t.state == ENDED then
   gameMode = Str3
    end
end
        end

@creative_novice - first, put three ~ before and after your code to format it properly (if you go back and edit your post above, you’ll see what I did to fix it).

I’m not sure what you mean by the coordinates to the second page. You always draw on the main screen, and your code in Str2 and Str3 seems to do this OK.

PS you can’t have two accounts. I deleted createnoob.

@Ignatz he means the coordinates for the text upper in draw, @creative_novice, try to make an rect behind the text then it will be easier and also make prints to see what action happens currently

@creative_novice Here’s your code with the correct touch coordinates for the different gameModes. When you draw a Sprite, the default is to use the center of the Sprite. The first 2 sprites have a size of 70x70 and the third a size of 101x171. When you want the touch coordinates of the sprites, it the sprites x coordinate - and + 1/2 the sprites width. The bottom and top are the sprites y coordinate - and + 1/2 the sprites height. See the values I use in the touched function for the different gameModes. Hope that answers your question, if not let me know.

function setup()
    gameMode = Str1
end

function draw()
    background(40, 40, 50)
    gameMode()
    strokeWidth(5)
end

function Str1()
    background(255, 255, 255, 255)
    sprite("Platformer Art:Block Grass", WIDTH/2, 384)  --70x70 Sprite size
    font("Baskerville-BoldItalic")
    fill(0, 0, 0, 255)
    text("1", WIDTH/2, HEIGHT/2.4)
end

function Str2()
    background(255, 255, 255, 255)
    sprite("Platformer Art:Block Brick", WIDTH/1.5, 384)   --70x70 Sprite size
    font("Baskerville-BoldItalic")
    fill(0, 0, 0, 255)
    text("2", WIDTH/1.5, HEIGHT/2.4)
end

function Str3()
    background(255, 255, 255, 255)
    sprite("Planet Cute:Dirt Block", WIDTH/2, 384)   --101x171 Sprite size
    font("Baskerville-BoldItalic")
    fill(0, 0, 0, 255)
    text("3", WIDTH/2, HEIGHT/2.4)
end

function touched(t)
    if gameMode == Str1 then
        if t.x>WIDTH/2-35 and t.x<WIDTH/2+35 and 
                t.y>384-35 and t.y<384+35 and t.state == ENDED then
            --music("Dropbox:Test")
            gameMode = Str2
        end
    end
    if gameMode == Str2 then
        if t.x>WIDTH/1.5-35 and t.x<WIDTH/1.5+35 and 
                t.y>350 and t.y<450 and t.state == ENDED then
            gameMode = Str3
        end
    end
    if gameMode == Str3 then
        if t.x>WIDTH/2-50 and t.x<WIDTH/2+50 and 
                t.y>384-85 and t.y<384+85 and t.state == ENDED then
            gameMode = Str1
        end
    end
end

Dave, I adore you! many thanksv