Jump to: navigation, search

Tutorial Entities

Working with Entities

Cubiverse supports a number of entities (which I hope to grow over the next few releases). They are invisible cubes that have a special purpose, such as spawning a mob or allowing you to create some generic JavaScript object to call from other entities or cube scripts.

Some entities perform operations automatically, like mob or player spawn points, so you don't really have to edit or add scripts to them. Of course the purpose of Cubiverse is for you to control these things, so you're free to add additional code to any entity to control their operation (such as causing players to spawn at certain points depending on how far other players are progressing in the world).

Normally you will use "Free Cubes" mode to place entities "float in air".


Entity Types

For a complete list of entity types please see the Scripting API page, this shows all current entities.


Entity Mode

Editing in Cubiverse is caused by you equipping the world editor, if you do not have the world editor then you cannot edit the world (i.e. you don't own it!). For more information on how to equip the world editor, see this article

Select the entity editing mode, by clicking the entity mode button:

entityIconEditor.png

The tool-bar also contains larger buttons on the left side that present the modes of operation.

EntityToolBar.png

Remember you can use the keyboard to switch modes quickly, the small number (or letter) in the bottom left of the icon shows they correct key to use. For example 1.. add entity, 2.. delete entity, etc..


Mode Selection colors

When you change the voxel edit mode, the selection cube will change color:

EntitySelectionCubes.png


Add Entity

Adding an entity is almost identical to adding in voxels, except your placing Entities.

Just like with Voxel editing, you have a selector for changing the type of Entity you are going to stamp down. At the bottom right of the window you will see:

EntityTypeSelection.png

Using the mouse wheel you can cycle through the available list of entities; for a complete list of entity types please see the Scripting API page, this shows all current entities.


Delete Entity

To delete an entity simply select the "delete entity" operation and mouse the mouse over the entity you wish to delete. When you click the mouse the entity will be deleted,. The only way to undo a delete is to click the "abort changes" button, but this will undo all changes applied since you entered the editor.

When you "play" the world any deleted entities will be permanently deleted.


Move Entity

Sometimes you need to move an entity, such as a player or mob spawn point because it's not in the correct position.

Using the move operations tool you can select the cube and move it to it's new location, you must HOLD DOWN the mouse button whilst moving the entity to it's new location.


Edit or Add Script to Entity

We have a whole section of how to write scripts, but from a world editor point of view you simply select the "Edit Script" mode, and move the white selection cube over the entity you wish to apply or edit the script on.


Sticky or Free Cubes?

First thing you will notice when adding entities (or other things) is that when you go to add any new entities they stick to other cubes. This makes it easier to add entities to existing structures, because they snap into place, but in practice you usually want to place entities in the air above zones or spawn points.

Using the "stick cube" or "free cube" buttons:

stickyCubes.png

For "free" entity placement, you can use the mouse wheel to change the distance of where the entity is placed..

stickyFreeCubesExample.png