Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / 2d platformers

Author
Message
Chaos
21
Years of Service
User Offline
Joined: 8th Feb 2003
Location: United Kingdom
Posted: 18th Apr 2003 23:21
i have posted this question in the dark basic board as well.
PLEASE
Can someone here tel me how to make the levels on a platformer i would be grateful and it would go towards help make a 2d tutorial on the subject of all types of 2d games

Note: i am asking for an example using sprites and not 3d objects.
note2: I know sprites are slow but ,y comp rauns them fast at an fps rate of 73 average

Thanx in advance

GODS
Darkworlds are all around us
most of us are still half asleep
Current project : Creature tournament
andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 19th Apr 2003 00:11 Edited at: 19th Apr 2003 00:12
Why did you post in 2 different places?
You are making a tutorial? How can you make a tutorial if you don't know how to do it?

One way to do it is a tile system. You would have different images, the same size, for different objects such as ground, platform, etc.

You could use data statements to save this information.

Data 1,0,0,0,3,2
Data 3,0,2,0,0,2
Data 0,2,0,0,4,2

Each number represents a different tile.
Then read the data and if its a 1, for example, paste a block in the correct area.

This is just a basic idea. To make it work is more complicated.

All programmers are playwrights and all computers are lousy actors." -Anon.
<--- Uh... Um... Oh I forgot
darkCorridor
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location:
Posted: 19th Apr 2003 12:16
I made a Sort of Tile editor for my Mario game that never got off the groud. it saved to files with each image number ("120132132130123021203") etc.

[br]mikey
Chaos
21
Years of Service
User Offline
Joined: 8th Feb 2003
Location: United Kingdom
Posted: 19th Apr 2003 13:34
@ Andrew11 i am making a tutorial for people like me who find a severe lack of 2d tutorials on the net.BTW i know the way u r describing i used it in a pac man like game a few months ago but now i need to know how to make levels in a 2d platformer.

Thank u

Darkworlds are all around us
most of us are still half asleep
Current project : Creature tournament
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 19th Apr 2003 20:38
the way I make levels is
I store the info in a 2d array
create a level editor drawing the level fullsize with scrolling
use a grid selection system for mouse click
have a list of tiles or a scrolling tile box on the side to select which tile to paste when clicking on it.
I use a mutli layer level system with one level set to a blocking layer(where you can't go) on my editor these squares are out line in a color - like red for never, blue if condition 1 is met and so fouth
it's really quit simple

I write a seperate file for enemy placement so that when you pass a given point the enemy come on the screen and I store there movement in 2d arrays as well so that I may give them predefined patterns to move in.


CTP

Armeggadon
21
Years of Service
User Offline
Joined: 10th Apr 2003
Location: United States
Posted: 20th Apr 2003 18:18
when you store things in an array(i have done the same thing with my levels making a .txt file of all my maps) but once i've done that how do i load the info from the array into the game. the only thing i can seem to do is rewrite the entire array into the code. how do i get the game to read from the array into the game

Current Status: Learning DBPro

I consider myself: ULTRA NEWB!!!!!!!!!!!
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 21st Apr 2003 00:45
heres the code out of one of my map editors for save and load
CTP

Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 22nd Apr 2003 07:20
Well, you can find lots of 2D examples here, including platform game collision/gravity + sprite scrolling examples.

` Collision stuff is about mid way down the page
http://www.dbcode.underwaredesign.com

l8r,
Kevin Picone
[url]www.underwaredesign.com[/url]
Steven Craft
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location:
Posted: 30th Apr 2003 05:55
When I started looking at getting a level made I ran into the same problems with finding help on the net, so I just worked it out myself using methods which made sense to me, therefore there maybe problems all over the place, but, incase you are interested, here's a few idea's.

-Use a Map Editor, there's no need to make your own, there are many out there already, I decided to use 'Tile Studio' (which has a Map Studio built into it). I didn't do too much research before choosing this program, it just seemed to do what I needed it to.
-Tile studio has a scripting language built into it, so you can specify how it saves the maps you create, I made a little export script that outputs 3 files which can then be read into darkbasic, if you use TileStudio then try out using this export code:

This will give you 4 files, 1 will be the bitmap of the tiles you have used, one will be an ini file that holds the map parameters, 1 will be a txt file which contains map data of which sprites go where and finally a .col file that holds information about the collisions. You can pretty much ignore the .col file for now, I needed to use it to allow collisions to work specially (for example in sonic you can jump UP through many ledges, but then don't fall back through them).

So once you have created your map in tile studio, used that script, you should have the 4 files mentioned, put them into your darkbasic working directory, you then need to import the data into a sensible place, for me i put the map parameters into variables, and the mapdata and collision map into two dimensional arrays, and the bmp of the tileset needs to be seperated into seperate tiles.

I found darkbasic couldn't read int's from an external text file so I borrowed and modified someone else's routine to get around this, here are my basic scripts to read in the data:
MAP PARAMETERS

LOAD SPRITES

COLLISION MAP

MAP DATA


They are functions, the parameters them each take are all reasonably self explantory, basically the parameter function needs to be run first, that just takes the map name, the name of the files you exported, for example "map1" if you have "map1.bmp", "map1.txt", "map1.ini" and "map1.col" in your working directory. This function then sets the values of the sprite dimensions and map dimensions. You can then call the other functions with this information to load up the sprites, load in the mapdata into an array.

From there you can do what you want with it, basically if you read the sprites in from 0 to [number of sprites used], then the sprites numbers will DIRECTY relate the numbers in the MapData array, for example MapData[10][10] might have '6' stored in it, that means at position 10,10 on the screen, sprite 6 should be displayed.

It looks like other people have given other links for tutorials and examples simliar to what I have mentioned so I wont go into any more detail, however, if you would like any more information just ask and I'll try and explain in more detail and give some examples of how to integrate this functions into a game, (at the moment i have a game that can take any map made from tile studio, then i have a character that can run around the level, colliding with what he should collide with, acceleration as he runs, jumping, animations for the character, camera scrolling, and am more then happy to share any knowledge I have so far.

Steve

Login to post a reply

Server time is: 2024-04-25 18:34:34
Your offset time is: 2024-04-25 18:34:34