Problem. I can t see two images at same time

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Cruiser23rus
Prole
Posts: 9
Joined: Mon May 04, 2009 11:41 am

Problem. I can t see two images at same time

Post by Cruiser23rus »

Hello. My english is not so well, but i try to describe my problem. Today i try Love engine and i have some trouble with displaing images. I need 3 "layers" with image on each of it's. 1 image on background, second image some closer, and third image most closer then other two. I wright Lua-script, but it's no work. I see only one image (second), which i draw more last then first image . I think i do mistake somewhere. Please, help me. I read documentation, but i can't find information about this case (and there's no documentation on russian language, i'm from Russia). Lua - new program language for me (first day). I hope you understand what i whant to say about my problem.
Thank you. I will waiting for your answers.

There i wright my Lua-code:

Code: Select all

function load() 
    image = love.graphics.newImage("images/back.png")
    image2 = love.graphics.newImage("images/kolob.png")
end 
 
function draw() 
    love.graphics.draw(image, 400, 300)
end   
 
function draw()     
  love.graphics.draw(image2, 700, 500)
end 

User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Problem. I can t see two images at same time

Post by bartbes »

The problem is you don't draw the background image, only the front one, because your second draw function overwrites the first one, do it like this:

Code: Select all

function load()
    image = love.graphics.newImage("images/back.png")
    image2 = love.graphics.newImage("images/kolob.png")
end

function draw() 
    love.graphics.draw(image, 400, 300)
    love.graphics.draw(image2, 700, 500)
end 
Cruiser23rus
Prole
Posts: 9
Joined: Mon May 04, 2009 11:41 am

Re: Problem. I can t see two images at same time

Post by Cruiser23rus »

Bartbes, thank you very mach!!! You so help me. It' s work!!!
And if i want to do third image, i can do by your example. Thank you.

And one more question. My png images have alpha zone (i save them with alpha). But in the project they displayed without alpha. I must change any parametrs for alpha png?
I read about "set color" alpha, but nothing about png alpha. Do you know something about it?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Problem. I can t see two images at same time

Post by bartbes »

If the alpha channel is really in the image LÖVE should automatically show them correctly, make sure alpha didn't get changed to white when saving.
Cruiser23rus
Prole
Posts: 9
Joined: Mon May 04, 2009 11:41 am

Re: Problem. I can t see two images at same time

Post by Cruiser23rus »

ok. Thank you. I ll chek it. Good day to you.
Cruiser23rus
Prole
Posts: 9
Joined: Mon May 04, 2009 11:41 am

Re: Problem. I can t see two images at same time

Post by Cruiser23rus »

Bartbes, if you still heare. You know, it s png files with alfa. I cheked it. I try to attach thoose files heare. Look at them, please.
What can you advise me? May be some setings in Love?
Attachments
back.PNG
back.PNG (15.5 KiB) Viewed 8321 times
kolob.PNG
kolob.PNG (665 Bytes) Viewed 8325 times
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Problem. I can t see two images at same time

Post by Robin »

Are you sure they have alpha? It doesn't seem that way to me.
EDIT: I gave kolob.png a transparent background. This is the result:
kolob2.png
kolob2.png (558 Bytes) Viewed 8330 times
Does this give you the right result?
Help us help you: attach a .love.
Cruiser23rus
Prole
Posts: 9
Joined: Mon May 04, 2009 11:41 am

Re: Problem. I can t see two images at same time

Post by Cruiser23rus »

Robin, i don't know what cause of my mistake, but you are right. Thank you.. You know, my windows explorer show me alpha. White color is absent in explorer at this pictures. Hm.. And how did you do this? I must remake my other pictures..

I try to do game-tale about "kolobok" for my child - its old russian tale fore children. =))
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Problem. I can t see two images at same time

Post by Robin »

I used IrfanView. Save As .png and click on the color you want transparent. Although I use other tools that can do that also, but IrfanView is the easiest for quick fixes.
Help us help you: attach a .love.
Cruiser23rus
Prole
Posts: 9
Joined: Mon May 04, 2009 11:41 am

Re: Problem. I can t see two images at same time

Post by Cruiser23rus »

Thank you, Robin. I dounload Ifran now. On my second PC installed Photoshop, but this computer often use my wooman. I think i install on my computer Photoshop too. This pictures i draw in standart Paint of Windows. =) And picturues not cool.
Ok. Thank you. I show you game when it will be done.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 6 guests