Jump to content
Sign in to follow this  
Niator

[JAVA HELP] How do I tile a game?

Recommended Posts

If Steve still would have been here, he would have helped me with this...

Basically I want to tile my game so the positions will be in squares. (Like pokemon and runescape).
Anyone know how to do this?

Share this post


Link to post
Share on other sites
This a broad question, lol. What specifically are you asking? I got "how do I write a tiled game" from this.

Share this post


Link to post
Share on other sites
I remember you had a 2d game project going and it had tiles... what happened...?

Share this post


Link to post
Share on other sites
[quote name='lukedawesome']I remember you had a 2d game project going and it had tiles... what happened...?[/QUOTE]
No it didn't. It was just a "tile" for each pixel...

@Trey: Wut?

Share this post


Link to post
Share on other sites
[quote name='Niator']No it didn't. It was just a "tile" for each pixel...

@Trey: Wut?[/QUOTE]

You're basically just asking how to write a tiled game. That question is way to broad to answer. If you have any specific questions about tiled games, then ask them, otherwise you're not going to get anything out of this thread.

"How to do I make a program?"

Not trying to be a dick, just trying to figure out specifically what you're needing help with.

Share this post


Link to post
Share on other sites
[quote name='Trey']You're basically just asking how to write a tiled game. That question is way to broad to answer. If you have any specific questions about tiled games, then ask them, otherwise you're not going to get anything out of this thread.

"How to do I make a program?"

Not trying to be a dick, just trying to figure out specifically what you're needing help with.[/QUOTE]
I just need an explanation on how I could make one, not a complete code >.>

Share this post


Link to post
Share on other sites
[quote name='Niator']I just need an explanation on how I could make one, not a complete code >.>[/QUOTE]

Well, you basically divide the screen into X by X tiles. Usually, you store these in a 2D array of some sort into a map or levels/worlds, specific to your game. When the user clicks, you'd divide the x and y of their click coordinate by the dimension of the tile to determine which tile the clicked on the screen. Etc.

Other than that, it's not much different.

Share this post


Link to post
Share on other sites
[url]http://lmgtfy.com/?q=Slick+2d[/url]

I would say start with Slick 2d considering it has massive amount of tutorials and documentation.

Share this post


Link to post
Share on other sites
pseudocode
[code]canvas = ... // set up canvas
image = ... // load 16x16 tile image into memory
MAP_SIZE = 10
for (y = 0; y < (MAP_SIZE * 16); y += 16)
for (x = 0; x < (MAP_SIZE * 16); x += 16)
canvas.draw(image, x, y);[/code]

this is assuming you want to know how to draw a basic map using tiles

edit: considering you want help with more than just generating a simple map, i'll give you some ideas on how to accomplish several things without resorting to using Slick2D.

say you want a basic rpg thing like the first zelda game, you'll want to create the tiles and write a map editor and a reader that reads the map file and renders it. also, you'll want to write an entity system so either be a noob and use a typical object hierarchy or look into component based entity systems and you can also add a simple way of saving items and stats a player gains (give every item its own id and sprite) and load that too. then just work on assets and gameplay and pls remembr that if you want to write a game, write a game. don't write a super modular game engine to go with it, just write the game. Edited by _s1gma

Share this post


Link to post
Share on other sites
Tile[][] tiles = new Tile[x][y];
tiles[0][0] = new Tile(TileType.GRASS);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×