-2

I have been searching the past few days but can't seem to find anything on how to read .png files and then build levels off of that. I already know how to load images and files, but how does one go about pulling data out of them in order to build game levels. Anyone care to enlighten me? By the way I use Java.

Bart
  • 19,692
  • 7
  • 68
  • 77
x3zinja12
  • 21
  • 1
  • 1
  • 5

1 Answers1

2

You are thinking too high-level. The programming language doesn't know what a "game" is, or a "level." You can load an image file, that's great -- now you have a set of binary data in memory. There is no meaning attached to those bits. What you need is a model representing your level; perhaps, for example, you could simply have two images, one of which is the 'background' and one of which is an occlusion map. For example, black areas on the second image are impassable/blocking, while the first image is simply the level as it is displayed.

When you're writing in a "real" programming language, and not a game-building toolkit, the building of a model to represent your problem is your responsibility.

asthasr
  • 9,125
  • 1
  • 29
  • 43