Getting Foreground to act like Background

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

Nigey
Posts: 35
Joined: 17 Dec 2014, 21:55

Getting Foreground to act like Background

Postby Nigey » 27 Feb 2015, 13:14

Hi Guys,

I'm having an issue with the foreground in OpenSpace. With the background it scrolls with the map perfectly, which suits the environment because it's kinda large. With the foreground it's fixed in place. I want to make a semi-transparent (coloured glass) banister which only partially blocks the view of a player when he's next to it. However the foreground is stuck onto the viewport and doesn't move. So when the player moves towards this banister, it moves away from him. The foreground will run along the entire length of the map, and will ideally be partly outside of the bounds of the map. To fit in well with the background image.

Is there a way to do this?

Thanks
User avatar
Bax
Site Admin
Posts: 4608
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Getting Foreground to act like Background

Postby Bax » 03 Mar 2015, 10:26

I'm not sure I can entirely understand what you need to achieve.
Anyway, the foreground works like this: if its overall size is smaller than the background overall size, a parallactic effect is applied during the map scrolling. If its size is the same as the background's one, then it should scroll just like the background.
Does this help?
Paolo Bax
The SmartFoxServer Team
Nigey
Posts: 35
Joined: 17 Dec 2014, 21:55

Re: Getting Foreground to act like Background

Postby Nigey » 03 Mar 2015, 12:07

Hi Bax,

Thanks for responding. I was about to add to this actually. What I'm basically trying to achieve is to make a semi-transparent glass wall running along the length of the bottom of the map. I want the player to be able to walk behind it. So when he does this he see's himself semi-transparent behind the object. Does this make sense? I've tried doing this by making it into a larger skin and placing it in the map. As it's running along the bottom of the map and the player will never be in front of it. I've placed it on the very last tile as a skin now. However the player cannot click to move onto any tiles 'behind' the glass wall. Is there a way to make that area traversable? Does this problem make sense to you?

I thought to avoid this issue I could simply set the glass wall as a foreground, so the player will always be behind it, and it wont stop the player clicking on tiles 'underneath' it. However the foreground isn't 'stuck' onto the scrollable map, and instead just sticks to the camera, meaning it wouldn't stay in place in the map.

Does this now make sense, and do you have any suggestions?

Thanks!
Nigel
User avatar
Bax
Site Admin
Posts: 4608
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Getting Foreground to act like Background

Postby Bax » 03 Mar 2015, 12:35

Using the skin of the top-most tile is a good idea. What if you set its mouseEnabled property to false? It should become transparent to clicks.
You can give the skin a name in the Editor and then use the IOpenSpace.getSkinByName method to get a reference to it.
Paolo Bax
The SmartFoxServer Team

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 12 guests