Easy q.
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Easy q.
What exactly do you want? What do you mean by 'at a particular x and y'?
Help us help you: attach a .love.
Re: Easy q.
If I have a function that draws something, how do I make it at a cirtain x, & y without actually putting it in.
Like love.graphics.draw( drawable, x, y, r, sx, sy, ox, oy )
insead of entering x, and y, can one enter nothing for the x, & y but still make it execute at a particular place?
Like
function drawthing()
love.graphics.draw(drawable)
end
How can I make drawthing occur at a particular x, & y without actually entering it in? Is there another way?
I feel so stupid. -_-
Like love.graphics.draw( drawable, x, y, r, sx, sy, ox, oy )
insead of entering x, and y, can one enter nothing for the x, & y but still make it execute at a particular place?
Like
function drawthing()
love.graphics.draw(drawable)
end
How can I make drawthing occur at a particular x, & y without actually entering it in? Is there another way?
I feel so stupid. -_-
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: Easy q.
How would it possibly know where to draw the thing unless you tell it? However, you don't necessarily have to enter numbers literally. You could draw it to coordinates from a variable. For example, if you wanted to draw something at the cursor, you would do:Xoria wrote:How can I make drawthing occur at a particular x, & y without actually entering it in? Is there another way?
Code: Select all
function love.draw()
love.graphics.draw(ourimage, love.mouse.getX(), love.mouse.getY())
end
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Easy q.
Maybe you mean that you want to use default values for x and y?
This function will accept x and y as parameters. If you don't pass them, it will assign them 100 and 200.
Code: Select all
function drawthing(drawable, x, y)
x = x or 100
y = y or 200
love.graphics.draw(x,y, drawable)
end
Code: Select all
drawthing(drawable, 500, 600) -- draws drawable thing on x=500, y=600
drawthing(drawable) -- draws drawable thing on x=100, y=200
When I write def I mean function.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Easy q.
Fail: it should be love.graphics.draw(drawable, x, y).kikito wrote:Code: Select all
function drawthing(drawable, x, y) x = x or 100 y = y or 200 love.graphics.draw(x,y, drawable) end
@Xoria: do you expect LÖVE to know where you want your image to be drawn, or something else?
Help us help you: attach a .love.
Re: Easy q.
Nah, those last 2 posts did it for me. Tnx as usual.
Who is online
Users browsing this forum: Ahrefs [Bot] and 3 guests