Interesting Problem with X and Y Values...

Blitz3D Forums/Blitz3D Beginners Area/Interesting Problem with X and Y Values...

OwlEpicurus(Posted 2009) [#1]
When I try to use the same variables for drawing two different images on the screen, the images appear in different places. I have not changed the handles, and the images are being drawn one after the other with no other code in between. What are the possible reasons for this?


Andy(Posted 2009) [#2]
Can you post some code?


OwlEpicurus(Posted 2009) [#3]
I'm not sure which part of the code could be causing the problem, and I don't want to post the whole 15 KB program. The code that draws the images on screen is:

DrawImage pathcorner4\image,x,y
DrawImage pathcorner2\image,x,y


The error probably is not there, though. Should I post the rest of the code?


OwlEpicurus(Posted 2009) [#4]
After rewriting some of the code, I have managed to get everything where it is supposed to be. However, I do not know why I had to add something to the x and y values in certain instances. Here is the function:



The line

DrawImage pathcorner1\image,x,y


is drawn correctly without the adjustments to the x and y values the others seemed to need.

On the other hand, in the lines

DrawImage pathcorner1\image,x,y
	y = y+ImageHeight(pathcorner1\image)-5
	x = x+ImageWidth(pathcorner1\image)
	DrawImage pathsegmentV\image,x,y


pathcorner1\image is supposed to have the same x value as pathsegmentV\image, yet they do not appear on screen with the same x value unless ImageWidth(pathcorner1\image) is added to x.


Pongo(Posted 2009) [#5]
Are you sure you haven't used ImageHandle() or midhandle() somewhere in your code?


OwlEpicurus(Posted 2009) [#6]
I'm positive.


Pongo(Posted 2009) [#7]
I don't see anything when looking through quickly. It would help to have a fully working example if you could. If you post just the code, you can just state the image sizes and I can plug in something of my own.

Edited the post above to ask about midhandle() as well.


OwlEpicurus(Posted 2009) [#8]
Here's the code in full:



Sizes for the images in question are:

pathsegmentH\image 480 X 131
pathcorner1\image 130 X 132

The other images are 90 degree rotations of these two.

And no, I did not use midhandle() either.


Stevie G(Posted 2009) [#9]
The other images are 90 degree rotations of these two.


I suspect that this is your issue. AFAIK using rotateimage will rotate the imagehandle also. If so, you will need to reset it to be top left after rotation.

Stevie


OwlEpicurus(Posted 2009) [#10]
Thanks. That's probably where the problem is.