I need help on an old project

I’ve nearly given up on this project after not coding for nearly a year. But I’m still hoping I could get some help. I’ve got another problem in my code and it’s a tough one. But I can’t really do anything about it since it’s a little too out of my league. But anyway, I need help from absolutely anyone.

Please help…

Can you please describe whats you issue or problem?
What are you trying to develop or the piece where you are stuck at?
Best regards!

I’m having some trouble. I’m trying to create a function where you place the sprite on a red rectangle (or the weighted cube on the button), the door function should be set to true. But this is only working on my second level where this function is first used. Here is my code.

function level2()
    background(50, 61, 130, 255)
    level2Paint()



if zx>ex and ey<zy and dx>sx-20 and dx<sx+20 and dy>sy-20 and dy<sy+20 then
        sx = vx
        sy = vy
        lv=lv+1



    end





sprite("Documents:Cube",zx,zy,50,50)




     --in Portal?   
    if dx>sx+20 and dx<sx+20 and dy>sy-20 and dy<sy+20 then
        sx = vx
        sy = vy

        --in case xport elipse overlaps portals
        moved=true
        moved1=true  
    end
    end

    -- when character and object are in the portal at the same time moved variables get messed 



    function level3Paint()   
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(0,50,2000,15)
    popMatrix()
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(0,370,2000,15)
    popMatrix()
    pushMatrix()
    rotate(90)
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(50, -500,2000,15)
    popMatrix()
    pushMatrix()
    fill(181, 141, 64, 255)
    stroke(255, 105, 0, 255)
    strokeWidth(2)
    ellipse(px,py,60,120)
    fill(64, 76, 181, 255)
    stroke(0, 17, 255, 255)
    strokeWidth(2)
    ellipse(hx,hy,60,120)        
    fill(47, 47, 47, 255)
    stroke(255, 255, 255, 255)
    strokeWidth(2)
    ellipse(dx,dy,120,120) 
    popMatrix()
    pushMatrix()
    fill(255, 0, 0, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(1)
    rect(lx,ly,80,15)
    popMatrix()
    pushMatrix()




end
function level3()   
    background(66, 78, 120, 255)
    level3Paint()



    if fx<lx and ly>fy and dx<sx-20 and dx>sx+20 and dy<sy-20 and dy>sy+20 then
        sx = vx
        sy = vy
        lv=lv+1



    end





sprite("Documents:Cube",fx,fy,50,50)





    end

This looks like the same question and code you posted in another project over a month ago. Have you tried to do anything yourself in that time.

Actually, it’s the exact same post. Nobody bothered to help me with it on the other thread, plus all my partners have disappeared for more than a month and this’s as far as I could ever get.

Maybe no one is helping you because you’re not providing enough code or information. You’re saying the door function should be set to true, but it’s only working on the second level. If I look at level 2, I don’t see anything about a door function. You can’t just post some code that doesn’t look like it does anything and then ask people to fix it for you. You admit it’s the exact same code you posted over a month ago that you haven’t made any attempt to do anything to it. If you’re not going to work on your own code, why should anyone else. Were you expecting all your partners to write the code for you.

The problem with posting all of my code is because there’s so much of it that I have to put it all into separate posts. But I’ll try to do just that anyway since I’m kinda desperate. So her it is, the latest version of my game.


-- My Little Portal Beta Mode
displayMode(FULLSCREEN)

function setup()
    physics.gravity()
    lev={level1,level2,level3,level4,level5,level6,level7}
    lv=1
    --function setup()
 --et=elapsed time
 --tc=touch count
    et,tc=0,0
 --px,py = coordinates of orange portal
    px,py=300,400
 --hx,hy = coordinates of blue portal
    hx,hy= 700,300
 --vx,vy = landing place between levels
    vx,vy=200,435
 --sx,sy= coordinates of character
    sx,sy=vx,vy
 -- level transport location
    dx,dy=800,100
 --location of object on level 2
    zx,zy=200,250
 --location of button on level 2
   ex,ey=500,60
 --location of object on level 3
    fx,fy= 800,400
 --location of button on level 3
    lx,ly=100,60
--level 4 transport location
    cx,cy=800,500
--location of object on level 6
    rx,ry=500,90



end

function draw()
    --paint level
    lev[lv]()

 sprite("Documents:Chell",sx ,sy ,100)
    -- taps?
    drawTestPortalMoved()

    if not moved then
        drawTestForPlayerInPortal()
    else -- moved set to true
        drawTestPlayerLeftPortal()
    end








end
function touched(t)
    if t.state==BEGAN then
        et=ElapsedTime
        tc=t.tapCount
        tx=t.x
        ty=t.y
    elseif t.state==MOVING then
        --Move character
        if t.x>sx-30 and t.x<sx+30 and t.y>sy-30 and t.y<sy+30 then
            sx=t.x
            sy=t.y  
        end                
        --Move cube.  Once Character is over cube then cube & character move together.
         if t.x>zx-30 and t.x<zx+30 and t.y>zy-30 and t.y<zy+30 then
            zx=t.x
            zy=t.y  
        end    
        --The cube on level 3 should have the same effects as the one on level 2.
            if t.x>fx-30 and t.x<fx+30 and t.y>fy-30 and t.y<fy+30 then
            fx=t.x
            fy=t.y  
        end                      
       --The cube on level 6 should move and stick to the player as well.
        if t.x>rx-30 and t.x<rx+30 and t.y>ry-30 and t.y<ry+30 then
            rx=t.x
            ry=t.y  
        end                 
    elseif t.state==ENDED then
        moved1=false
    end    
end





function drawTestPortalMoved()
    if ElapsedTime-et>.2 and tc>0 then
        if tc==2 then
            hx=tx
            hy=ty
        elseif tc==3 then
            px=tx
            py=ty
        end
        tc=0
    end
end

function drawTestForPlayerInPortal()
    if px>sx-20 and px<sx+20 and py>sy-20 and py<sy+20 and not moved then
        -- move player to other portal
        sx = hx
        sy = hy
    elseif hx>sx-20 and hx<sx+20 and hy>sy-20 and hy<sy+20 and not moved then
        -- move player to other portal    
        sx = px
        sy = py

    end
    moved=true
    moved1=true
end


function drawTestPlayerLeftPortal()
    -- if player has left the portals
    if px>sx-20 and px<sx+20 and py>sy-20 and py<sy+20 then
        return
    end      
    if hx>sx-20 and hx<sx+20 and hy>sy-20 and hy<sy+20 then
        return
    end
    -- then    
    moved1=false
    moved=false
end

function drawTestForCubeInPortal()
    if px>zx-20 and px<zx+20 and py>zy-20 and py<zy+20 then
        -- move cube to other portal
        zx = hx
        zy = hy
    elseif hx>zx-20 and hx<zx+20 and hy>zy-20 and hy<zy+20 and not moved then
        -- move cube to other portal    
        zx = px
        zy = py

    end
moved=true
moved1=true
end


function drawTestCubeLeftPortal()
    -- if cube has left the portals
    if px>zx-20 and px<zx+20 and py>zy-20 and py<zy+20 then
        return
    end      
    if hx>zx-20 and hx<zx+20 and hy>zy-20 and hy<zy+20 then
     -- need seperate variables for character and cube  
return
end
    moved1=false
    moved=false



    end




function level1Paint()
    pushMatrix()

     --Draw white bars with black outline
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(650,50,200,15)
    rect(100,370,150,15)
    -- draw orange ellipse
    fill(181, 141, 64, 255)
    stroke(255, 105, 0, 255)
    strokeWidth(2)
    ellipse(px,py,60,120)
    --draw blue ellipse
    fill(64, 76, 181, 255)
    stroke(0, 17, 255, 255)
    strokeWidth(2)
    ellipse(hx,hy,60,120)
    --draw transport ellipse
    fill(47, 47, 47, 255)
    stroke(255, 255, 255, 255)
    strokeWidth(2)
    ellipse(dx,dy,120,120)  
    popMatrix()
end

function level1()
    background(31, 29, 62, 255)
    level1Paint()

    --inside level door?
    if dx>sx-20 and dx<sx+20 and dy>sy-20 and dy<sy+20 then
        sx = vx
        sy = vy
        --in case xport elipse overlaps portals
        moved=true
        moved1=true 
        -- go to level2
        lv=lv+1
    end
end

function level2Paint()   
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(300,50,500,15)
    popMatrix()
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(100,370,150,15)
    popMatrix()
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(100,220,150,15)
    popMatrix()
    fill(181, 141, 64, 255)
    stroke(255, 105, 0, 255)
    strokeWidth(2)
    ellipse(px,py,60,120)
    fill(64, 76, 181, 255)
    stroke(0, 17, 255, 255)
    strokeWidth(2)
    ellipse(hx,hy,60,120)        
    fill(47, 47, 47, 255)
    stroke(255, 255, 255, 255)
    strokeWidth(2)
    ellipse(dx,dy,120,120) 
    pushMatrix()
    fill(255, 0, 0, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(1)
    rect(ex,ey,80,15)
    popMatrix()
    pushMatrix()


end  
function level2()
    background(50, 61, 130, 255)
    level2Paint()



if zx>ex and ey<zy and dx>sx-20 and dx<sx+20 and dy>sy-20 and dy<sy+20 then
        sx = vx
        sy = vy
        lv=lv+1



    end





sprite("Documents:Cube",zx,zy,50,50)




     --in Portal?   
    if dx>sx+20 and dx<sx+20 and dy>sy-20 and dy<sy+20 then
        sx = vx
        sy = vy

        --in case xport elipse overlaps portals
        moved=true
        moved1=true  
    end
    end

    -- when character and object are in the portal at the same time moved variables get messed 



    function level3Paint()   
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(0,50,2000,15)
    popMatrix()
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(0,370,2000,15)
    popMatrix()
    pushMatrix()
    rotate(90)
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(50, -500,2000,15)
    popMatrix()
    fill(181, 141, 64, 255)
    stroke(255, 105, 0, 255)
    strokeWidth(2)
    ellipse(px,py,60,120)
    fill(64, 76, 181, 255)
    stroke(0, 17, 255, 255)
    strokeWidth(2)
    ellipse(hx,hy,60,120)        
    fill(47, 47, 47, 255)
    stroke(255, 255, 255, 255)
    strokeWidth(2)
    ellipse(dx,dy,120,120) 
    pushMatrix()
    fill(255, 0, 0, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(1)
    rect(lx,ly,80,15)
    popMatrix()




end
function level3()   
    background(66, 78, 120, 255)
    level3Paint()



    if fx>lx and ly<fy and dx>sx-20 and dx<sx+20 and dy>sy-20 and dy<sy+20 then
        sx = vx
        sy = vy
        lv=lv+1



    end

sprite("Documents:Cube",fx,fy,50,50)







     --in Portal?   
    if dx>sx+20 and dx<sx+20 and dy>sy-20 and dy<sy+20 then
        sx = vx
        sy = vy

        --in case xport elipse overlaps portals
        moved=true
        moved1=true  
    end
end
      function level4Paint()   
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(650,450,150,15)
    pushMatrix()
    rotate(90)
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(500,-370,150,15)
    popMatrix()
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(100,370,150,15)
    popMatrix()
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(100,50,900,15)
    popMatrix()
    fill(181, 141, 64, 255)
    stroke(255, 105, 0, 255)
    strokeWidth(2)
    ellipse(px,py,60,120)
    fill(64, 76, 181, 255)
    stroke(0, 17, 255, 255)
    strokeWidth(2)
    ellipse(hx,hy,60,120)        
    fill(47, 47, 47, 255)
    stroke(255, 255, 255, 255)
    strokeWidth(2)
    ellipse(cx,cy,120,120) 
   end
function level4() 
    background(31, 51, 127, 255)
    level4Paint()

    if cx>sx-20 and cx<sx+20 and cy>sy-20 and cy<sy+20 then
        sx = vx
        sy = vy
        --in case xport elipse overlaps portals
        moved=true
        moved1=true 
        --last level, go back to 1
        lv=lv+1
    end
    end
    function level5paint()   
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(650,450,150,15)
    pushMatrix()
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(100,370,150,15)
    popMatrix()
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(100,50,900,15)
    popMatrix()
    fill(181, 141, 64, 255)
    stroke(255, 105, 0, 255)
    strokeWidth(2)
    ellipse(px,py,60,120)
    fill(64, 76, 181, 255)
    stroke(0, 17, 255, 255)
    strokeWidth(2)
    ellipse(hx,hy,60,120)        
    fill(47, 47, 47, 255)
    stroke(255, 255, 255, 255)
    strokeWidth(2)
    ellipse(cx,cy,120,120) 
   end

    function level5() 
    background(31, 31, 80, 255)
        level5paint()


    if cx>sx-20 and cx<sx+20 and cy>sy-20 and cy<sy+20 then
        sx = vx
        sy = vy
        --in case xport elipse overlaps portals
        moved=true
        moved1=true 
        --last level, go back to 1
        lv=lv+1
    end
end
    function level6paint() 
    pushMatrix()
    rotate(90)
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(600,-500,100,15)
    popMatrix()  
    pushMatrix()
    rotate(90)
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(550,-370,100,15)
    popMatrix()  
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(100,370,150,15)
    popMatrix()  
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(650,450,150,15)
    pushMatrix()
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(500,350,150,15)
    popMatrix()
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(100,50,900,15)
    popMatrix()
    pushMatrix()
    fill(255, 0, 0, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(1)
    rect(550,360,80,15)
    popMatrix()
    fill(181, 141, 64, 255)
    stroke(255, 105, 0, 255)
    strokeWidth(2)
    ellipse(px,py,60,120)
    fill(64, 76, 181, 255)
    stroke(0, 17, 255, 255)
    strokeWidth(2)
    ellipse(hx,hy,60,120)        
    fill(47, 47, 47, 255)
    stroke(255, 255, 255, 255)
    strokeWidth(2)
    ellipse(cx,cy,120,120) 
   end

    function level6() 
    background(31, 31, 80, 255)
        level6paint()
    if zx>rx and ry<zy and dx>sx-20 and dx<sx+20 and dy>sy-20 and dy<sy+20 then
        sx = vx
        sy = vy
        lv=lv+1

    end

    sprite("Documents:Cube",rx,ry,50,50)







        --in case xport elipse overlaps portals
        moved=true
        moved1=true 
        --last level, go back to 1

        end




function level7paint()
    pushMatrix()
    fill(255, 0, 0, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(1)
    rect(100,229,80,15)
    popMatrix()
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(100,220,150,15)
    popMatrix()
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(650,450,150,15)
    pushMatrix()
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(100,370,150,15)
    popMatrix()  
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(100,50,900,15)
    popMatrix()
    popMatrix()
    fill(181, 141, 64, 255)
    stroke(255, 105, 0, 255)
    strokeWidth(2)
    ellipse(px,py,60,120)
    fill(64, 76, 181, 255)
    stroke(0, 17, 255, 255)
    strokeWidth(2)
    ellipse(hx,hy,60,120)        
    fill(47, 47, 47, 255)
    stroke(255, 255, 255, 255)
    strokeWidth(2)
    ellipse(cx,cy,120,120) 
end
function level7() 
    background(31, 31, 80, 255)
        level7paint()

    sprite("Documents:companion cube",rx,ry,75,75)

    if cx>sx-20 and cx<sx+20 and cy>sy-20 and cy<sy+20 then
        sx = vx
        sy = vy
        --in case xport elipse overlaps portals
        moved=true
        moved1=true 
        --last level, go back to 1
        lv=1
    end
end

@Chell I made the change below marked by <===== to the level6() code and I was able to get to level 7 and back to level 1, but I’m not sure what you’re having trouble with. A few suggestions, format your code so it’s easier to read. Remove the large groups of blank lines. I’m not sure anyone is going to look thru 600+ lines of code, try to understand what you’re trying to do and then try to find what isn’t working. I’m not sure what the object of you’re game is, what I’m supposed to do, or what you’re having trouble with. You know what you’re trying to do, yet you can’t find your problem. Other people have no idea what’s supposed to be happening, yet you want them to find your problem. How about a description of what is supposed to happen, the purpose of the things on the screen, and what and where you’re having a problem.

function level6() 
    background(31, 31, 80, 255)
    level6paint()


    if cx>sx-20 and cx<sx+20 and cy>sy-20 and cy<sy+20 then   <=======


    --if zx>rx and ry<zy and dx>sx-20 and dx<sx+20 and dy>sy-20 and dy<sy+20 then
        sx = vx
        sy = vy
        lv=lv+1
    end
    sprite("Planet Cute:Character Cat Girl",rx,ry,50,50)
    --in case xport elipse overlaps portals
    moved=true
    moved1=true 
    --last level, go back to 1
end

My problem is in level 3, where I was trying to replicate level 2’s button and cube puzzle, but even when the cube isn’t on the button the door is a usable exit to the next level. The purpose of the puzzle is to use portals to get the cube onto the button and then to the door. Here’s my code for level 3:

function level3Paint()   
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(0,50,2000,15)
    popMatrix()
    pushMatrix()
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(0,370,2000,15)
    popMatrix()
    pushMatrix()
    rotate(90)
    fill(255, 255, 255, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(3)
    rect(50, -500,2000,15)
    popMatrix()
    fill(181, 141, 64, 255)
    stroke(255, 105, 0, 255)
    strokeWidth(2)
    ellipse(px,py,60,120)
    fill(64, 76, 181, 255)
    stroke(0, 17, 255, 255)
    strokeWidth(2)
    ellipse(hx,hy,60,120)        
    fill(47, 47, 47, 255)
    stroke(255, 255, 255, 255)
    strokeWidth(2)
    ellipse(dx,dy,120,120) 
    pushMatrix()
    fill(255, 0, 0, 255)
    stroke(0, 0, 0, 255)
    strokeWidth(1)
    rect(lx,ly,80,15)
    popMatrix()




end
function level3()   
    background(66, 78, 120, 255)
    level3Paint()



    if fx>lx and ly<fy and dx>sx-20 and dx<sx+20 and dy>sy-20 and dy<sy+20 then
        sx = vx
        sy = vy
        lv=lv+1



    end
sprite("Documents:Cube",fx,fy,50,50)







     --in Portal?   
    if dx>sx+20 and dx<sx+20 and dy>sy-20 and dy<sy+20 then
        sx = vx
        sy = vy

        --in case xport elipse overlaps portals
        moved=true
        moved1=true  
    end
end

@Chell You’ve been working on this for a long time and not getting anywhere. Maybe you should work on something else that’s a little easier and build your coding experience and then come back to this code.

@dave1707 I think you’re right, but I literally just got my iPad back after it being lost for months. Plus I don’t know what else to work on. But I do take suggestions.

@chell Look at the program you’re currently trying to work on. Break that down into small sections and see what they’re doing. Write small programs that do what those sections are doing and keep changing the program so you understand exactly what’s happening. The idea is to write small programs that do parts of what you want a larger program to do. Once you understand how all the small programs work, then writing the large program will be easier. I’m constantly writing small programs to see exactly how the different Codea functions work and I make changes to see how that affect them. Once I fully understand what’s happening, I try another one I don’t understand. So don’t give up on your large program, just take smaller steps until you get more experience.

So should I work on just one level at a time and break down the problem?

Just take what you’re having trouble with and break that down into a small program and work on that until you understand what the problem is. Just have a simple program with the cube, button and portal and get that to work setting the variables to correct values that you want. The smaller the program you work with, the less things you have to look at if something doesn’t work.

Okay, I’ve crunched the problem as small as I could. It all comes down to where my variables from level 2 aren’t working. I thought that if I could just replace the variables from level 2 with new ones for level 3. But when I tried that, nothing happened. It’s like the whole thee lines of code didn’t exist. Here’s the code:

function level3()   
    background(66, 78, 120, 255)
    level3Paint()



    if fx>lx and ly<fy and dx>sx-20 and dx<sx+20 and dy>sy-20 and dy<sy+20 then
        sx = vx
        sy = vy




    end





sprite("Documents:Cube",fx,fy,50,50)




     --in Portal?   
    if dx>sx+20 and dx<sx+20 and dy>sy-20 and dy<sy+20 then
        sx = vx
        sy = vy

        --in case xport elipse overlaps portals
        moved=true
        moved1=true  
    end
    end


@Chell All you did was remove 1 line of code, lv=lv+1. What I meant by write small programs was just that. Start another program that has a button, cube, and a portal or whatever you have. They don’t have to do anything special. Move the cube and when it’s on a button or a portal set variables that indicate that you were on that object. If it’s on a portal, set a variable that says you can go to the next level. if it on a button, set a variable that says you’re on the button. When you get that doing everything you want it to, then use what you learned from that to fix the bigger program. If you can get one level working, the other levels should be easy.

@Chell It looks like you have a problem with if dx>sx+20 and dx<sx+20 in your code above. dx can’t be > sx+20 and also be < sx+20 at the same time. You need to make the first one sx-20.

Apparently, now Codea isn’t letting me change my code at all.