Java help!? sorry :P

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
Rebornxeno
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 85
Joined: Thu Jun 23, 2011 11:12 am

Java help!? sorry :P

Post by Rebornxeno »

Hello everyone! I have a problem and I'm not quite sure why it's a problem. Here is the code that is giving me a problem

Code: Select all

	private void analyzeImage(BufferedImage i){
		for (int y = 0; y == rect.height; y++){
			for (int x = 0; x == rect.width; x++){
				robot.getPixelColor(x, y);
			}
		}
	}
For some reason, nothing runs inside for(blah){}
No errors, no nothing. rect.height and rect.width are not 0. Maybe I'm a bit too stoned to see whats wrong but this is driving me insane!! Could somebody please help me?
Nothing is happening for me inside the for loops :(
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Java help!? sorry :P

Post by Falco Girgis »

It's because y == rect.height and x == rect.width are never true.

It should be for(int y = 0; y < rect.height; y++) and for(int x = 0; x < rect.width; x++);

The loop executes WHILE the middle term is true, not UNTIL the middle term is true.

And I've only met one person ever who can write good code while high on that hippie ass shit. If you want to be decadent and productive simultaneously, pop adderall or do lines of coke, because weed just makes you dumb. ;)
Rebornxeno
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 85
Joined: Thu Jun 23, 2011 11:12 am

Re: Java help!? sorry :P

Post by Rebornxeno »

I lol'd just then. Thank you *embarassed*
Post Reply