Changing the colors of the wall

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

Moderators: Lapo, Bax

HHJsyndrome
Posts: 23
Joined: 05 Oct 2010, 09:28

Changing the colors of the wall

Postby HHJsyndrome » 17 Feb 2011, 08:07

Hi, is there any way to change the colors of the wall of the room?

the reason I'm asking is because my game has this feature where the user can customize his/her room. So I need help regarding where I should start reading up or what can be done so that I can allow users to change the colors of the wall of the player's room.

thanks.
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 17 Feb 2011, 08:46

There isn't a specific feature for this in OpenSpace, but it shouldn't be too difficult to implement your own.
The first things that comes to my mind is that you could have a single tile, placed in (0,0) which contains the two walls which limit the map. Using a room variable you could save the wall color, and after a map is loaded and rendered you could read the room variable, access the skin of that tile representing the walls and set the color accordingly.
Hope this helps.
Paolo Bax
The SmartFoxServer Team
HHJsyndrome
Posts: 23
Joined: 05 Oct 2010, 09:28

Postby HHJsyndrome » 18 Feb 2011, 07:26

Hi, thanks for the reply. :D

I think it should work.

I've been going through the documentation but I wasn't able to find something that allows me to access the skin of that tile so that I can change it.

So I've done partially something like this below..

Code: Select all

if (roomName == "homeLvl1Map")
{
   var coordsTile:Position3D = new Position3D(0,0)
        var tile:Tile = openSpace.getTileByCoordinates(coordsTile)
}


So the code is like, when I enter the room called homeLvl1Map which is the user's home.. then get that particular tile by using the getTileByCoordinates()

so how do I change the tile's skin by coding?

I was like guessing tile.skin = skin; or something but there doesn't seem to be any skin property inside the tile object..

so how do I change the skin of the tile?

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

Postby Bax » 18 Feb 2011, 08:08

You can use the Tile.getTopSkin() method (if you have just 1 skin) or the Tile.getSkinByName() method (you have to give the skin an instance name in the Editor).
Substituting the skin is not recommended. You should probably call a method on your skin which changes the color internally.
Paolo Bax
The SmartFoxServer Team
HHJsyndrome
Posts: 23
Joined: 05 Oct 2010, 09:28

Postby HHJsyndrome » 22 Feb 2011, 05:29

I've managed to change the color of the walls, but the transparent areas of the walls that are overlapping the grids on the floor causes the grids below to be not clickable.

So now I'm thinking if there is another way to do this.. like substituting the background image.. Is it possible for me to swap the background image of the map? Is it recommended for me to do it that way?
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 22 Feb 2011, 09:50

In order to solve the transparency problem, simply remove the background of the bitmaps after importing them into Flash, followingthis tech note from Adobe.
Paolo Bax
The SmartFoxServer Team

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 54 guests