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.
Asked
Active
Viewed 176 times
-2
-
1Please be more concrete about your question: what images? what data? what exactly are you trying to do? – Hovercraft Full Of Eels Aug 24 '12 at 19:37
-
Check the placement of pixels on the image and then place blocks in the level based on that. – x3zinja12 Aug 25 '12 at 05:00
1 Answers
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