[SOLVED] Colour values

E

Edeyz

Guest
No matter what this always returns a 0.

>global.valueTotal = 0;
>currentPos = draw_getpixel(xPosition, yPosition);
>global.valueTotal += colour_get_value(currentPos);

I have tested this with all the pixels from this test image.
(image will be uploaded in a moment, the upload at image button is not working)

What have I done wrong?

Sorry I cant give you much more information that that.

Thanks
Edeyz
 
E

Edeyz

Guest
Yes, There is also a for loop that assigns xPosition and yPosition
The map is the size of the image I uploaded before

All settings are as implied and global.seperationDistanceGrid == 1
//width
for(xPosition = 1; xPosition <= global.mapWidth; xPosition += global.seperationDistanceGrid)
{
//height
for(yPosition = 1; yPosition <= global.mapHeight; yPosition += global.seperationDistanceGrid)
{
 
I could imagine it having something to do with the first line u posted:

global.valueTotal = 0;

It would permanently set it to 0. In a step event. I didn't quite understand your problem, but if I imagine it right, it can be something like this.

Assign that variable in a create event.
 
E

Edeyz

Guest
Sorry, I forgot to mention, this all happens in the create event. I have been watching the value through de-bug mode.

and
global.valueTotal = 0;
is at the very start before the for loop
 
E

Edeyz

Guest
Sorry, I think I have given you the wrong idea.
I don't want to steadily increase or decrease it. What I want to do with this, is add up all the values of each pixel in the image. and do that once.
 
Oh, okay! Sorry I misunderstood that.
What about trying to set it to the exact value instead of adding it? I never did stuff like that before, so I might only be confusing you. I thought of something else in the beginning. Sorry :/
 
E

Edeyz

Guest
That doesn't work work either.
I have never really done anything like this before either.
 
E

Edeyz

Guest
Never mind
I just figured out why.
Because I had this in the create event it was doing it before anything was drawn, and using the game maker title page (witch is black for the mostpart)

Thanks for your help though @LucasTheNewbie
 
Top