hey guys, i've been designing and coding a pokemon-clone game in java for roughly 3 months and i've a huge problem in my hands.

how the hell am i supposed to design a "map" in sprites?

for example, i've been reading "developing games in java" and it just gives me some cock and bull about using a text file to select and read the sprites, if the text contains "a", then you draw something and so forth, however that only leaves me with about 70 possible sprite choices, and to make any decent town (let alone the whole game) of pokemon it would take me roughly 1220 sprites.

has anyone here tried to make a pokemon-clone or a tilebased game and figured this out? thanks guys

Recommended Answers

All 3 Replies

You can define whatever you like. If you access the file as a binary file, you can use 256 values with a single byte. Or you can use two bytes, this would 65536 values.

Some things you may want to consider though:
- You'll need at least two layers for drawing sprites (i.e. base tiles with no alpha value, sprites/NPC's)
- The NPC's will likely be walking around, have things to say, challenge you to battles, etc. You may need to allocate more space to reference their attributes.

oh alright, well this is what i was thinking, i made a class called Sprite which holds an Animation (a set of Images) and also information about the sprite itself (can you walk in it, etc), all Actors in the game are also a Sprite.

i'll have to know more about binary files and how to use them, i was basically trying to find a way to design a map and have the game know how to parse it, perhaps 2 different files (one for terrain and other for NPCs).

also, could i get some tips on reading the text file as binary? how would you go about doing such a thing, assuming the text file is as follows, for example:

aaaaaaab
bbbbbbaa

given that a is water for example, and b is grass.(image)

some tips on reading the text file as binary

What do you mean by "reading file as binary"?
Most text files contain characters. If the text is English, there are 26 letters + 10 digits and some miscellaneous characters. Each character takes up one byte of the file.
A byte consists of 8 bits.
When you read a file what do you want to see for each byte(character) that you read from the file?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.