How do I create a level using different colours in a picture?

• December 26th, 2013, 05:07 PM
LukeR
How do I create a level using different colours in a picture?
I recently watched someone make a game, and they made a system to make a certain level on a plat-former by using a picture.
Basically, I have 6 pictures, and I want to draw them on the screen to make a level, by using the info from an image. How can I do this?:confused:
• December 26th, 2013, 05:31 PM
Norm
Re: How do I create a level using different colours in a picture?
What do you mean by a "level"?
• December 26th, 2013, 07:15 PM
LukeR
Re: How do I create a level using different colours in a picture?
Quote:

Originally Posted by Norm
What do you mean by a "level"?

Well, what I mean is that in Mario, there is a set level with all the enemies and platforms and what-not, and I just want to make a system to create one level for my game by just making a photo, unless there is a way that is just as easy once it is set up.
• December 26th, 2013, 07:41 PM
Norm
Re: How do I create a level using different colours in a picture?
Can you explain what you mean by a level? Is it a number, like floors in a building? Level 1 is the first floor, level 2 is the second, etc

What would "creating a level" mean? Would that be generating a random number say from 1 to 10?

Or would it be level of difficulty: level 1 is easy, level 10 is very hard.
• December 26th, 2013, 08:39 PM
LukeR
Re: How do I create a level using different colours in a picture?
Quote:

Quote:

Originally Posted by Norm
Quote:

Originally Posted by LukeR
Well, what I mean is that in Mario, there is a set level with all the enemies and platforms and what-not, and I just want to make a system to create one level for my game by just making a photo, unless there is a way that is just as easy once it is set up.

Can you explain what you mean by a level? Is it a number, like floors in a building? Level 1 is the first floor, level 2 is the second, etcetera.

What would "creating a level" mean? Would that be generating a random number say from 1 to 10?

Or would it be level of difficulty: level 1 is easy, level 10 is very hard.

Well, look at a platform game. There are platforms, spikes, enemies etc. And I want to make each level by creating a picture with different colours for each pixel, and the RGB value the pixel represents will make a certain thing in the game (For Example, in the image for the first map/level, I put a red pixel in the top corner. In the game, it reads the file, and puts a spike on the screen relative to the position in the picture.

Summary of my question: I want to be able to simply draw a new level, add a few lines of code and voila, I can enter that room or 'level'
• December 26th, 2013, 08:49 PM
Norm
Re: How do I create a level using different colours in a picture?
Quote:

I want to be able to simply draw a new ...
Are you talking about custom drawings?
See the tutorial about how to do custom paintings: Lesson: Performing Custom Painting (The Java™ Tutorials > Creating a GUI With JFC/Swing)
• December 26th, 2013, 09:04 PM
LukeR
Re: How do I create a level using different colours in a picture?
Are you even *** listening to me? I want to create a drawing like this: (I made the image 10x bigger for you to see it)
Attachment 2569
And it looks at the file, for every red pixel (the RGB value for red, (255,0,0)) it prints a certain picture to the screen in the same place relative to the picture, and for every orange pixel it does the same with some death-inflicting spikes
• December 27th, 2013, 06:05 AM
Norm
Re: How do I create a level using different colours in a picture?
Did you look at the link for custom painting?
• December 27th, 2013, 09:25 AM
LukeR
Re: How do I create a level using different colours in a picture?
Quote:

Originally Posted by Norm
Did you look at the link for custom painting?

Yes I *** did, but that has nothing to *** do with what I am asking.

I want to read every pixel, from left to right, through the entire image, and put a number in an array depending on the RGB value of the pixel.
• December 27th, 2013, 09:32 AM
copeg
Re: How do I create a level using different colours in a picture?
@LukeR, getting answers has as much to do with how a question is asked, and using profanity is not doing you any favors. Your posts have been edited. I suggest reading Lesson: Working with Images (The Java™ Tutorials > 2D Graphics)
• December 27th, 2013, 09:48 AM
LukeR
Re: How do I create a level using different colours in a picture?
Sorry, but atleast now I have an answer related to what I want.
But, for more explanation, watch the last five 2-3 minutes of this video
3D Game Programming - Episode 34 - Entities - YouTube