how do you make a solid object?

BlitzPlus Forums/BlitzPlus Beginners Area/how do you make a solid object?

Ice T.(Posted 2006) [#1]
In mario there are various objects that you can jump on, blocks, platforms,pipes, etc. in blitz+ how do you code these objects where you can jump on them and stay there untill you walk off or where you can hit against a wall and are forced to jump over it? I have used the simple stay on the specifyed x coordinate code for everything which makes it difficult for staying on a platform, or fall off a cliff :(


CS_TBL(Posted 2006) [#2]
There are technically no solid objects, there are only gfx.

You actually don't need gfx at all, gfx are just a means to know what you're doing. The actual game doesn't rely on gfx, only on maps.

Your map (platformers, rpg etc.) is just a 2d array. In that array are technical numbers, like '0' for air (which you can walk/fall through), '1' for platform or wall, '2' for a door etc. etc.

Then what you do is compare your player's x/y coordinate with this map and then you know whether you're bumping onto a wall or standing in air (upon which you should fall) etc.

So, gfx are not related, the game will run without 'em, you only need our players & NPC's and a 2d array for the technical map. Visually you'll be using another map for gfx, because you're likely to have more than one gfx-tile for platforms or walls.


CS_TBL(Posted 2006) [#3]
A variation on these maps is to have one array with gfx tiles, and their technical meaning is related to a specific range.

For example:

If you have 256 tiles in a picture, organised as 16x16 tiles, then you could work like: tiles 0..127 (0x0 - 15x7) are meant as wall-tiles, 128..159 (0x8 - 15x9) are air-tiles, the rest of your tiles could be something else.. (items, doors, etc.)

Then you only need to check on the tilenumber when comparing your player/NPC coordinates, if it's in 0..127 then it's a wall, if it's 128..159 then it's air, etc.


Ice T.(Posted 2006) [#4]
so there just tiles, all around, some able to go through, others you cant right?


CS_TBL(Posted 2006) [#5]
..if you program it like that, then yes. The important thing here is to divide game logic from graphics. If you require a wall or a platform in your map than just code it without using gfx, think of solutions without thinking in terms of graphics & art.


Ice T.(Posted 2006) [#6]
I see... much more of a programmed invisable wall than a solid object

thanx


xlsior(Posted 2006) [#7]
I see... much more of a programmed invisable wall than a solid object


Exactly.


DjBigWorm(Posted 2006) [#8]
Hey,
don't mean to counter what you said. Here is a link to a game I am working on with graphics as my collision parts too, instead of just logic. When I started I didn't have anyone to talk to about how to do that kind of Game. I was very interested in platform games and dreamt up how it was done. I built a map using graphics as the floors, walls, etc... This way I can have pixel perfect collision while the player walks up and down irregular floors and such. The Game Earth Worm Jim to better explain it was what I was shooting for. Not saying this method is faster, just works for me. That is all Peace

Link http://www.gameplacestudios.com/gameplace/uploads/PDdownloads/mad_roach.zip


CS_TBL(Posted 2006) [#9]
That's an option indeed, tho I don't really like having to depend on actual graphics, I'd still prefer a technical map, could be pixel-perfect.. but alas.. to each his own taste.

In any case I *think* Ice T is a beginning user, EWJ would be one step too much I think.. let's start with something easy like Manic Miner. :P


Ice T.(Posted 2006) [#10]
yes, I'm quite new, and ooh! manic miner! I wish I could do that. like DjBigWorm I too am very interested in platformers but know nothing of it, dont get me wrong, I may be a beginner but I can at least load an image and make it move. so how do you suggest I get to the level of knowledge where I can at least make a simple manic miner game?


CS_TBL(Posted 2006) [#11]
Dunno, it all depends on what you already know or not. In the late 80's I've spend ages on small little crappy basic programs. Little of them did something that made sense, from today's perspective. But I guess that's the way things work: small steps, no rushing.

Do you understand all the program flow commands? (for-next, select, if-then, functions, local&global variables, arrays, banks, timers, etc. etc.)


Ice T.(Posted 2006) [#12]
Ok, thanks Ill take small steps