Jump to content

background and sprite layers click only on sight (z order?)


oddskill
 Share

Recommended Posts

Hello.

 

First of all im an absolute beginner in phaser and game related programming in general,

so sry if that topic is already covered in some example, if so plz give me a link, tx.

 

Lets say we have a background like

http://picthost.net/v.php?id=dc26ca428c6589e7a396ed99ec9ccce8

 

Now i want some sprites to show sliding up from behind the diffrent

"mountains". 

 

Is there an easy way to achive that in phaser?

Do i have to make multiple layers with transparency and the diffrent mountains?

How to make only the visible part of the appearing sprites clickable?

 

Any suggestions / links ?

 

best regards

 

Chris

Link to comment
Share on other sites

If you want things to be between different mountains I would make each one separately with transparency and add them in the order you see fit.

As for clicking visible parts.
http://examples.phaser.io/_site/view_full.html?d=input&f=pixel+perfect+click+detection.js&t=pixel%20perfect%20click%20detection

and

http://examples.phaser.io/_site/view_full.html?d=input&f=pixelpick+-+atlas.js&t=pixelpick%20-%20atlas

Link to comment
Share on other sites

Thank you Dumtard,

 

both links link to the same url but i got the point of the pixelperfect click detection.

 

So basically i have to calculate by myself if a sprite is visible or is there already a way to make

something like a "hidden border polygon" that prevents the sprites from receiving the on click event ?

 

best regards

 

Chris

Link to comment
Share on other sites

I edited the second link, not sure why it was pointing to the same thing.

As for your question, I am not sure but I believe if a sprite is behind another the top sprite will receive the click event and the bottom one will not, which is what I believe you are asking. I am not at a computer I can make a quick test on so I am not sure.

Link to comment
Share on other sites

Thank you very much Dumtard.

I can test that by myself.

I consider my question answered, if i will encounter a problem i will open a new thread

regarding the specific problem with code example.

 

best regards

 

Chris

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...