Mode 7 also i want to know how to do slopes in this effect

I am wanting to make a mode 7 racing game with codea.I am asking how to the mode 7 effect and with slopes also.I am planning to make it have PixelArt too.I want to know also how to make tilemaps.Also how to make tilemaps do things like increase speed and make the player be in the for a certain of time.

@donhard I had to lookup what Mode 7 was. Look at this game I made and see if it’s close to what Mode 7 is. Read thru the discussion for instructions to play then copy the code at the bottom of the discussion.

https://codea.io/talk/discussion/8932/starter-game-22#latest

https://m.youtube.com/watch?v=ffe5RX09R5w
Watch this video Dave1707. This is an example of snes mode 7 games with slopes. Lets see if these examples that this YouTube video shows are possible on codea

@donhard if I were going to re-make mode 7 graphics in Codea I’d look up the maths and render directly to a low-res texture using setContext() then up-scale the texture as a full-screen sprite using the noSmooth() rendering option

@donhard Here’s something that creates a surface with slopes. I don’t have a good texture, so I’m just using the Stone Brick image. Drag 1 finger to rotate the image and 2 fingers to change the camera position.

PS. Give it a few seconds to load.

displayMode(FULLSCREEN)

function setup()
    assert(OrbitViewer, "Please include Cameras (not Camera) as a dependency")        
    scene = craft.scene()
    skyMaterial=scene.sky.material
    skyMaterial.sky=color(137, 186, 223, 255)
    skyMaterial.horizon=color(98, 142, 229, 255)
    scene.sun.rotation=quat.eulerAngles(30,30,0)
    v=scene.camera:add(OrbitViewer,vec3(px,0,pz), 1000, 0, 2000)
    v.camera.farPlane=5000
    v.rx=30
    
    texture=readImage("Surfaces:Stone Brick Height")
    
    size=1000
    groundHeight=200   
    val=10
    step=.4
    h=craft.noise.perlin()
    for x=-val,val,step do
        for z=-val,val,step do           
            local y=h:getValue(x,0,z)
            local p1=vec3(x*size,y*groundHeight,z*size)
            y=h:getValue(x+step,0,z)
            local p2=vec3((x+step)*size,y*groundHeight,z*size)
            y=h:getValue(x+step,0,z+step)
            local p3=vec3((x+step)*size,y*groundHeight,(z+step)*size)
            y=h:getValue(x,0,z+step)
            local p4=vec3(x*size,y*groundHeight,(z+step)*size)
            createTile(p1,p2,p3,p4)
        end
    end
end

function draw()
    update(DeltaTime)
    scene:draw() 
end


function update(dt)
    scene:update(dt)
end

function createTile(p1,p2,p3,p4)
    local c=color(255)
    local pt=scene:entity()
    pt.model = craft.model()
    pt.model.positions={p1,p3,p4,p1,p2,p3}
    pt.model.indices={1,2,3,4,5,6,6,5,4,3,2,1}
    pt.model.colors={c,c,c,c,c,c}
    pt.model.uvs={vec2(0,0),vec2(1,1),vec2(0,1),vec2(0,0),vec2(1,0),vec2(1,1)}
    pt.material = craft.material("Materials:Basic")  
    pt.material.map=texture    
end

@donhard Here’s an updated version. I combined the above code with some code from my game from the link at the top of this discussion. Tilt the iPad to control the ship direction.

displayMode(FULLSCREEN)

function setup()
    assert(OrbitViewer, "Please include Cameras (not Camera) as a dependency")        
    scene = craft.scene()
    skyMaterial=scene.sky.material
    skyMaterial.sky=color(137, 186, 223, 255)
    skyMaterial.horizon=color(98, 142, 229, 255)
    scene.sun.rotation=quat.eulerAngles(30,30,0)
    v=scene.camera:add(OrbitViewer,vec3(px,0,pz), 1000, 0, 2000)
    v.camera.farPlane=5000    
    speed,ey,ang=20,45,0
    cameraX,cameraZ=-205,-205
    hgx=Gravity.x
    texture=readImage("Surfaces:Stone Brick Height")    
    size=1000
    groundHeight=200   
    val=10
    step=.4
    h=craft.noise.perlin()
    for x=-val,val,step do
        for z=-val,val,step do           
            local y=h:getValue(x,0,z)
            local p1=vec3(x*size,y*groundHeight,z*size)
            y=h:getValue(x+step,0,z)
            local p2=vec3((x+step)*size,y*groundHeight,z*size)
            y=h:getValue(x+step,0,z+step)
            local p3=vec3((x+step)*size,y*groundHeight,(z+step)*size)
            y=h:getValue(x,0,z+step)
            local p4=vec3(x*size,y*groundHeight,(z+step)*size)
            createTile(p1,p2,p3,p4)
        end
    end
end

function draw()
    update(DeltaTime)
    scene:draw() 
    updateCameraPos()    
    checkTilt() 
    drawShip()   
end

function update(dt)
    scene:update(dt)
    scene.camera.position = vec3(cameraX,200,cameraZ)
    scene.camera.eulerAngles=vec3(0,ey,0)
end

function createTile(p1,p2,p3,p4)
    local c=color(255)
    local pt=scene:entity()
    pt.model = craft.model()
    pt.model.positions={p1,p3,p4,p1,p2,p3}
    pt.model.indices={1,2,3,4,5,6,6,5,4,3,2,1}
    pt.model.colors={c,c,c,c,c,c}
    pt.model.uvs={vec2(0,0),vec2(1,1),vec2(0,1),vec2(0,0),vec2(1,0),vec2(1,1)}
    pt.material = craft.material("Materials:Basic")  
    pt.material.map=texture    
end

function updateCameraPos()
    ey=ey-ang
    x=speed*math.sin(math.rad(ey))
    z=speed*math.cos(math.rad(ey)) 
    cameraX=cameraX+x
    cameraZ=cameraZ+z
end

function checkTilt()
    gx=Gravity.x
    ang=ang+(gx-hgx)*4
    hgx=gx
    if gx>-.001 and gx<.001 then
        ang=0
    end
end


function drawShip()
    pushMatrix()
    translate(WIDTH/2,HEIGHT/2-200)
    rotate(ang*-30)
    sprite("Tyrian Remastered:Boss A",0,0,50)
    translate()
    popMatrix()
end