Tile based problem


(Ali Malik Wains) #1

As i already said, i am not a experienced programmer, still trying to learn. So my problem is, if i have tile based map (in .PNG format) how would i create a map using that asset… i have seen an example but it was out of my capability to understand unless someone explains, he just wrote the code without even telling… so i just wanna know how to make a map using tile-base system (on what calculations)


#2

Hi there @Ali_Malik !

If you’re looking to use tilemap with XML files I’d suggest you watch these series:

He pretty much explains how it works with OGMO.

Also, you could download this game made by a brazilian company called Miniboss:

It comes with a source code so you can feel free to explore how it was developed, they basically used Entities that spawn in their positions due to a XML file.

I think that sums up all I know so far about tilemaps in this framework.

If there is any other way I can help, I’d be glad to do so, but I think that the project is very simple to understand.


(Ali Malik Wains) #3

I have seen that video before, but the problem is… what if i have my code for my player already generated ? if i edit the player in OGMO then should i edit that code again? the main deal is… i don’t know how to set the X/Y of OGMO player to the player i generated (in player.as)??? can you please give me just a bit example… just create an empty world and write some OGMO code (i can understand that XML format and OEL) just write the simple Player code (in player.as) just simple, more like a prototype… (i would like an animated hero code too) once you’re done showing me code of the player (with its animation property) i am sure i will be able to add many more things in my game world… so lets make “player” as an example? please?

(@zachwlewis can you help me on that too bro? XD sorry if i am disturbing you… it will be my pleasure if i learn under the leash of an expert like you… thank you so much)


(Ali Malik Wains) #4

Here is the XML file, (though i can’t upload .OEL, so i upload .XML, but the code inside them is same… so not a big deal… just rename it to .OEL, after downloading)

level1.xml (7.6 KB)

My ground tileset (32x32px * 2 = 64x64px)

My hero spritesheet (80x58px * 6x4 = 480x232px)

All you got to do is… create a player.as code, and define (it doesn’t mean you actually have to define, just put COMMENT) how we put this code inside…


#5

@Ali_Malik

Tell you what, if I have the time I’ll make a simple project to show you how I would do it, that is if @zachwlewis doesn’t do it first.

Thanks for your attention!


(Zachary Lewis) #6

The level creation is completely separate from the player code. OGMO just helps you create XML files that FlashPunk can then read and create the level. Then, you can add your existing player entity to the level and you should be good to go.


(Ali Malik Wains) #7

So what you actually mean is, whenever we create an OEL, the player entity has a unique ID which can be integrated with our code? … by that… we can replace our existence player with the player inside the OEL… i understood the philosophy (as i guess) … because we don’t have to add external player, if we are making map through OGMO… all i need is… how we use to put actually player inside the OGMO LEVEL (the “replacing” thing is just … i can’t guess …) so just a written game files (.AS) can be better example for me… (as i am not pro XD haha i am self learned) still it will be lot better to understand than understanding the philosophy…


(Ali Malik Wains) #8

Thank you so much… @Macronaut i will wait for the code!! :slight_smile: thanks!!