I'm a noob in this engine and I just learned how to use getWidth() and getHeight() from an Image object and I was looking for getX() or something like that in the forum but nothing relevant.
Thanks a lot.
(Sorry for the bad English)
How can I get the coordinates of an Image?
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: How can I get the coordinates of an Image?
Images don't have coordinates. They appear wherever you love.graphics.draw them, where you specify the coordinates yourself. So you already have the coordinates.
Conventionally, games tend to use a table for each character, so say player={}. Then we set player.x=30 and player.y=50, for instance. And in love.draw, we use player.x and player.y for the draw coordinates. That way, you can check player.x and player.y whenever you want.
Conventionally, games tend to use a table for each character, so say player={}. Then we set player.x=30 and player.y=50, for instance. And in love.draw, we use player.x and player.y for the draw coordinates. That way, you can check player.x and player.y whenever you want.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Re: How can I get the coordinates of an Image?
I see, thanks TaehlTaehl wrote:Images don't have coordinates. They appear wherever you love.graphics.draw them, where you specify the coordinates yourself. So you already have the coordinates.
Conventionally, games tend to use a table for each character, so say player={}. Then we set player.x=30 and player.y=50, for instance. And in love.draw, we use player.x and player.y for the draw coordinates. That way, you can check player.x and player.y whenever you want.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], CharlesAceta and 1 guest