Page 2 of 3
Re: Using sprites from a tileset
Posted: Sun Apr 03, 2011 7:54 am
by Robin
Evrim wrote:Thanks Robin for explaining that, will that dot trick work on images too because I started adding loads of sprites and the folder is getting filled by images
No, that is just to remain compatible with modules. For images, you need to give the full relative path.
Evrim wrote:and a new problem, I found a tricky way for making a main - by re-moving (not remove) the images, I took them to very far away off the screen and screen gets cleared
You can also just not draw them.
Evrim wrote:But after I press S, screen clears supposedly but after I press Q, it quits the game even I set onMainMenu to false in S
That's because you set onMainMenu to true every time a key is pressed. You need to keep track of the state and use that.
Re: Using sprites from a tileset
Posted: Sun Apr 03, 2011 8:29 am
by Evrim
Robin wrote:Evrim wrote:Thanks Robin for explaining that, will that dot trick work on images too because I started adding loads of sprites and the folder is getting filled by images
No, that is just to remain compatible with modules. For images, you need to give the full relative path.
Example?
Robin wrote:Evrim wrote:and a new problem, I found a tricky way for making a main - by re-moving (not remove) the images, I took them to very far away off the screen and screen gets cleared
You can also just not draw them.
How not draw them?
Robin wrote:Evrim wrote:But after I press S, screen clears supposedly but after I press Q, it quits the game even I set onMainMenu to false in S
That's because you set onMainMenu to true every time a key is pressed. You need to keep track of the state and use that.
Okay
Re: Using sprites from a tileset
Posted: Sun Apr 03, 2011 8:33 am
by Robin
Evrim wrote:Robin wrote:No, that is just to remain compatible with modules. For images, you need to give the full relative path.
Example?
If you have an image of a tree in "images/tree.png", use:
Code: Select all
love.graphics.newImage("images/tree.png")
Evrim wrote:Robin wrote:You can also just not draw them.
How not draw them?
Code: Select all
function love.draw()
if state == 'menu' then -- or however you keep track of state
-- draw menu things
else
-- draw game things
end
end
Re: Using sprites from a tileset
Posted: Sun Apr 03, 2011 8:39 am
by Evrim
In case state changes, will draw entities will disappear?
EDIT: Yes they do, thanks for the help again
Re: Using sprites from a tileset
Posted: Sun Apr 03, 2011 8:47 am
by Robin
Evrim wrote:In case state changes, will draw entities will disappear?
Jup.
LÖVE doesn't have entities, actually. All love.graphics.draw does is copy the pixels from the image to the screen, and the screen is cleared between frames. (Actually there is more to it than that, but I think this explains it well enough.)
Re: Using sprites from a tileset
Posted: Sun Apr 03, 2011 8:54 am
by Evrim
Now, I included another lua file for movement but it 'expects' user data
draw
Code: Select all
love.graphics.drawq(dwarves, char, x1, y1)
load
Code: Select all
char = love.graphics.newQuad(0, 0, 24, 24, 360, 24)
dwarves = love.graphics.newImage("dwarves.png")
Re: Using sprites from a tileset
Posted: Sun Apr 03, 2011 8:57 am
by Robin
Could you make a .love of your game so we can take a look at it? We need more information to be able to help you.
Re: Using sprites from a tileset
Posted: Sun Apr 03, 2011 9:01 am
by Evrim
http://ul.to/wphqziif
Hoping that I uploaded correctly
Re: Using sprites from a tileset
Posted: Sun Apr 03, 2011 9:13 am
by Robin
- Please upload .loves as attachments next time, it's easier for all of us.
- Ditch onMainMenu. You already have state.
- You need to require movement.lua if you want LÖVE to use it.
Re: Using sprites from a tileset
Posted: Sun Apr 03, 2011 9:19 am
by Evrim
I was to say that problem was caused after I require movement
EDIT: Fixed it, I just took newImage and newQuad to love.draw...