Difference between revisions of "CBlob::setPosition"

From King Arthur's Gold Wiki
Jump to: navigation, search
Line 9: Line 9:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
+
Example from: Base/Rules/CommonScripts/Editor.as
Example, which would set given blob's position to the position of player's mouse cursor.
+
(This will create a block blob to player's mouse cursor position)
(Given that this blob is currently controller by a player)
+
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
this.setPosition(this.getControls().getMouseWorldPos());
+
CBlob @block = CreateBlob( "genericitem", "Entities/Structures/Stone/Block1x1.cfg" );
 +
block.setPosition(getControls().getMouseWorldPos());
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 00:09, 29 September 2012

Sets a new position for the blob.


This function will set the new position for the blob.

void setPosition( Vec2f pos )

Example from: Base/Rules/CommonScripts/Editor.as (This will create a block blob to player's mouse cursor position)

CBlob @block = CreateBlob( "genericitem", "Entities/Structures/Stone/Block1x1.cfg" );
block.setPosition(getControls().getMouseWorldPos());


Object method of: CBlob