How would I make a top-down map like this?

Hi I was wondering how to make a top down map with physics in codea. I would like some of the aspects to be randomly generated too but that’s ok if I can’t. Would making something like this ( http://i.imgur.com/IfzUPTP.png) be relatively easy and how would I do it? Thanks!

That’s a pretty big question. How much do you know about programming? It’s easier to answer questions like this when you know how much depth you’ll want.

I’m still probably a beginner as you can see with all my questions XD

It’s probably better to start simpler - generally when you begin programming things, you’ll want to think of the simplest game possible, then make something simpler!

It sounds simple to make, but if you take a quick loop at the dungeon roller example (which is similar to what you ask for), you can see a whole lot of code and tabs and other stuff.

I suggest you start making something like pong, as there are lots of tutorials for it for a variety of different languages, and despite it’s simplicity it has all the major elements of a game - winning/losing, a goal, a game loop, and so on.

Regardless of what you choose to do, good luck! You’ve learnt a lot, quickly, judging by your previous posts.

Thanks! I’ll look into doing that! It is probably better I don’t get in over my head

@compactbear. It sounds like you are making a snake-type game. Which I love, being old-school. :smiley:

Start with that and get just the bare bones up and running, even if it’s just directing a snake around an empty background. Then add your features on one-by-one. Just adding one little thing each step, you can learn different things. Saving scores, detecting collisions, shooting, walls to get in the way, tiled backgrounds, etc. Finally, maps and seeking routines. End of the level Bosses! Eventually, you will have the game you want along with some mad programming skillz!

@compactbear Are you after something like this. You would have to create new sprites for your walls and whatever else you want to show. I just used existing sprites for this example.


displayMode(FULLSCREEN)
supportedOrientations(LANDSCAPE_ANY)
    
function setup()
    size=35
    sprite("Planet Cute:Wall Block")
    rectMode(CENTER)
    sp={}
    table.insert(sp,"Planet Cute:Grass Block")
    table.insert(sp,"Planet Cute:Wall Block")
    table.insert(sp,"Small World:Tree Cone")
    map={{2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
         {1,1,1,1,1,1,1,1,1,1,2,1,1,2,1,1,1,2,1,1,1,1,1,1,1,1,1,2},
         {1,2,2,3,1,1,2,1,1,1,1,1,1,1,1,1,2,1,3,1,2,1,1,1,1,1,1,2},
         {1,2,1,1,2,1,1,1,2,1,1,1,1,1,1,2,1,1,1,2,2,1,1,1,2,1,1,2},
         {1,1,1,2,1,1,2,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,2,1,1,1,2},
         {1,2,2,1,1,1,2,1,1,1,1,1,1,1,1,1,2,3,1,1,2,1,1,1,1,1,1,2},
         {1,2,1,1,2,1,1,1,2,1,1,1,1,1,1,2,1,1,1,2,2,1,1,1,2,1,1,2},
         {1,1,1,2,1,1,2,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,2,1,1,1,2},
         {1,1,1,1,1,1,2,1,3,1,2,2,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,2},
         {1,2,2,1,1,1,1,1,1,1,2,1,2,1,2,1,1,2,1,1,1,2,1,3,2,1,1,2},
         {1,1,1,1,1,1,2,1,1,1,2,2,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,2},
         {1,2,2,1,1,1,1,1,1,1,2,1,2,1,2,1,1,2,1,1,1,2,1,1,2,1,1,2},
         {1,2,1,1,2,1,1,2,1,1,1,1,1,1,2,1,1,1,1,2,1,1,1,1,1,1,1,2},
         {1,1,1,2,1,1,1,1,1,1,2,1,1,2,2,1,1,1,1,3,1,1,1,1,1,1,1,2},
         {1,1,1,2,1,1,2,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,2,1,1,1,2},
         {1,1,1,1,1,1,2,1,1,1,2,2,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,2},
         {1,2,2,1,1,3,1,1,1,1,2,1,2,1,2,1,1,2,1,1,1,2,1,1,2,1,1,2},
         {1,2,2,1,1,1,1,1,1,1,2,1,2,1,2,1,1,2,1,1,1,2,1,1,2,1,1,2},
         {1,1,1,1,1,1,2,1,1,1,2,2,1,1,1,1,1,1,1,1,2,1,1,1,3,1,1,2},
         {1,2,2,1,1,1,1,1,1,1,2,1,2,1,2,1,1,2,1,1,1,2,1,1,2,1,1,2},
        }
end

function draw()
    background(40,40,50)
    fill(255)
    for a,b in pairs(map) do
        for c,d in pairs(b) do
            sprite(sp[1],c*size,HEIGHT-a*size,size,size*1.4)
            if d~=1 then
                sprite(sp[d],c*size,HEIGHT-a*size,size,size*1.4)
            end
        end
    end
end

I would do a grid-based system like at dave1707 is showing you. Grid-based is nice because it is simple for 2D things and it makes it (IMO) very easy to make a level-editor.

@compactbear I changed the above code to make the map table bigger and have the map match the orientation of the screen. I also added another sprite. You can add different values to the table to show other sprites.

Also, you could look at the Map code for my game 10Life 2 on Codea Community… That one uses custom collisions, though. I’m not sure how you’d use the built-in physics engine on a top-down scene, it was designed for a side view.

@SkyTheCoder linearDamping and no gravityScale = top down 2D physics

Dave thanks! Thats what I was thinking of!