Michdd Posted July 22, 2009 Share Posted July 22, 2009 Is it possible to grab, and set the x,y coordinates of images? I'm wondering because I want to create a map editor for a tile-based game in JS/PHP. It's just for fun, I can already do this in flash without a problem. I'm just curious if it's possible this way. Quote Link to comment Share on other sites More sharing options...
Michdd Posted July 22, 2009 Author Share Posted July 22, 2009 I know I can get the coords through document.images.imagename.offsetTop and offsetLeft. But as far as I know it's not possible to edit the image's coordinates though that. Is there another way? Because I need to be able to create new images, and set their x,y Quote Link to comment Share on other sites More sharing options...
haku Posted July 23, 2009 Share Posted July 23, 2009 You can get their x and y co-ordinates the way you just said, then add top and left margins to move them to the point you want. Or else you can set the image with absolute positioning, which will allow you to set the specific distance from the sides of the monitor. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.