|
Post by OddChild on Nov 17, 2006 18:13:18 GMT -5
I have noticed just now that the getheight doesnt work if the image is scaled.. it gets the height of the originial image...
sub main()
if (graphics.initialize <> True) then exit sub graphics.setTitle "Demo - Sphere Collision - press [ESC] to exit" key.initialize Font1 = graphics.createFont ("System", 14) image1 = graphics.loadimage("object1.bmp", &HFFFFFFFF) image2 = graphics.loadimage("object2.bmp", &HFFFFFFFF) graphics.setscaleX image1, 2 graphics.setscaleY image1, 6 With graphics .setX image1, x .setY image1, y .setX image2, 200 .setY image2, 200 End With do while bRunning = True if key.pressed(1) or key.pressed(0) = True then bRunning = False if key.pressed(200) = True then y = y - .15 : graphics.sety image1, y ' move Up if key.pressed(208) = True then y = y + .15 : graphics.sety image1, y ' Down if key.pressed(203) = True then x = x - .15 : graphics.setx image1, x ' Left if key.pressed(205) = True then x = x + .15 : graphics.setx image1, x ' Right ' this is the simple example ret = graphics.GetCollisionCircle(image1, image2) graphics.clear 255 graphics.settext graphics.getheight (image1), 10,10,Font1 If ret = true then graphics.settext "Collision Detected", 10,30,Font1 graphics.setimage image1 graphics.setimage image2 graphics.display loop key.terminate graphics.terminate
end sub
Call Main
paste into collision example
|
|
|
Post by Guilect on Nov 17, 2006 18:31:20 GMT -5
Fixed.
for now since you are setting the scaling and know the scaling just multiply the scaling by the .getheight or .getwidth values.
|
|
|
Post by u9 on Nov 17, 2006 19:19:30 GMT -5
Gulp... of course now I have to go fix my code that used scaled images but no worries, this is better.
|
|
|
Post by Guilect on Nov 17, 2006 21:03:00 GMT -5
I had always thought that the getwidth of an image should return the actual width of the image and if you scaled an image you could use GetScaleX and multiply that by the returned width. And I assume that is what U9 did. Now by changing the behavior to report the image width including scaling it breaks his code. But now this way makes things simplier and code a bit cleaner. I just don't consider it a bug, but rather a request for a change in the behavior of a command that works.
|
|