A Bed

metouto

Active Member
Contributor
Art
I was trying something new ... a bed ....

I placed this in definitions/furniture/Bed.groovy....


* Copyright 2011 Benjamin Glatzel <benjamin.glatzel@me.com>.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.terasology.data.blocks.definitions.furniture

/**
* A bed is interesting for two reasons: 1) it is a place for you to sleep 2) also a place for you to respawn to in the
* future (???).
*/
block {
version = 1

// Graphics
faces {
sides = "BedSide"
end1 = "BedFootEnd"
end2 = "BedHeadEnd"
top = "BedTop"
}



I have also put above 4 faces (in image form) in images/furniture/

BedFootEnd.png
BedHeadEnd.png
BedSide.png
BedTop.png



and it looks like this ......





So, I know this from the picture I can make a completely new block and it will show up in a test run !!!!! this is a very good thing for me :D but also I know ......

1) there is no bottom to this block

2) it is not what a bed should look like but close

3) image block uses BedSide.png BedTop.png

4) image block does not uses BedFootEnd.png BedHeadEnd.png


OK .... after you are done :laugh: and falling out of your chairs (and that is ok :) ) could you explain a little what I might have done wrong and how to correct it
 

Attachments

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Well, I can't see the image (at work, could attach to the forum post and then it shouldn't be blocked), but the answer to why only the sides and top show is in the variable names used in the definition :)

There are six actual faces to a block, and those have very specific names - don't have the code handy, but it is something like top, bottom, back, front, left, right

In addition there are a few magic names the definition will catch to mean multiple faces at once - so "sides" count as left, right, back, and front.

There's no end1 or end2, so that's why those images aren't used. Simply try using "back" and "front" instead (assuming my memory is correct, which is no guarantee)

If you do that after setting sides = BedSide.png the system is smart enough to apply BedSide to all 4 side faces first, but then overwrite back and front, so you get the correct 4 side faces, along with top. Bottom should automatically try to look for "Bed.png" since it isn't otherwise defined. If the game actually runs without a "Bed.png" present, I'm not sure what's going on as last I knew that should make it fail to load :D

As for the bed as a concept, cool! Yay furniture. Since a bed isn't a square (unlike say a quirky bookcase) we eventually probably will apply a custom "shape" to it, like for stairs. Another option is to use a two-block approach, where you have separate bed front and back blocks that line up. But then you start hitting fun with rotations etc... so yeah, simple beds are a good first step :)

Nicely done!
 

metouto

Active Member
Contributor
Art
It should be able to see it now Cervator ;)

Another option is to use a two-block approach, where you have separate bed front and back blocks that line up. But then you start hitting fun with rotations etc...
:?: so this would also be the thinking behind creating a door sense it is a two block item also :?:
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Yep! I see it now. Almost looks like a canopy bed :D

Yeah, doors would also be two-block constructs, probably hooked up to a meta-object of a sort to make sure both blocks react when you open/close the door.
 

metouto

Active Member
Contributor
Art
Did the "back" and "front" thing .... now things are still like a "canopy bed" but all sides are in the bed but top is out of rotation and position. Well, I have to have something to do tomorrow .... right ?
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Without a custom shape that might be about as far as you can get with a fancy object like a bed :)
 
Top