UUpdate Tutorials
This commit is contained in:
0
playground/Bundled/canvas/MyCanvas.files
Normal file
0
playground/Bundled/canvas/MyCanvas.files
Normal file
1
playground/Bundled/canvas/MyCanvas.json
Normal file
1
playground/Bundled/canvas/MyCanvas.json
Normal file
@ -0,0 +1 @@
|
||||
{"name":"untitled","x":0,"y":0,"width":960,"height":540,"elements":[{"id":0,"type":0,"name":"Text","event":"","x":3,"y":3,"width":753,"height":34,"text":"Leenkx Playground (press F to spawn box)","asset":"","color":-1,"anchor":0,"children":[],"visible":true,"rotation":0,"color_text":-1}],"assets":[],"visible":true,"theme":"Default Light"}
|
||||
1
playground/README.md
Normal file
1
playground/README.md
Normal file
@ -0,0 +1 @@
|
||||
https://github.com/lnxnkx3d/lnxnkx/wiki/playground
|
||||
32
playground/Sources/lnx/SpawnBox.hx
Normal file
32
playground/Sources/lnx/SpawnBox.hx
Normal file
@ -0,0 +1,32 @@
|
||||
package lnx;
|
||||
|
||||
import iron.object.Object;
|
||||
import iron.system.Input;
|
||||
import iron.Scene;
|
||||
import leenkx.trait.physics.RigidBody;
|
||||
|
||||
class SpawnBox extends iron.Trait {
|
||||
public function new() {
|
||||
super();
|
||||
// We want to get notified every frame
|
||||
notifyOnUpdate(update);
|
||||
}
|
||||
|
||||
function update() {
|
||||
// f key was pressed
|
||||
if (Input.getKeyboard().started("f")) {
|
||||
// Spawn Box object
|
||||
Scene.active.spawnObject("Box", null, boxSpawned);
|
||||
}
|
||||
}
|
||||
|
||||
// Box just got spawned
|
||||
function boxSpawned(o:Object) {
|
||||
// Translate cube to the location of empty object
|
||||
var traitOwner = object;
|
||||
o.transform.loc.setFrom(traitOwner.transform.loc);
|
||||
// Box object has a rigid body trait
|
||||
// Notify physics system to take new location into effect!
|
||||
o.getTrait(RigidBody).syncTransform();
|
||||
}
|
||||
}
|
||||
64
playground/Sources/lnx/node/MoveCylinder.hx
Normal file
64
playground/Sources/lnx/node/MoveCylinder.hx
Normal file
@ -0,0 +1,64 @@
|
||||
package lnx.node;
|
||||
|
||||
@:access(leenkx.logicnode.LogicNode)@:keep class MoveCylinder extends leenkx.logicnode.LogicTree {
|
||||
|
||||
var functionNodes:Map<String, leenkx.logicnode.FunctionNode>;
|
||||
|
||||
var functionOutputNodes:Map<String, leenkx.logicnode.FunctionOutputNode>;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
this.functionNodes = new Map();
|
||||
this.functionOutputNodes = new Map();
|
||||
notifyOnAdd(add);
|
||||
}
|
||||
|
||||
override public function add() {
|
||||
var _GetObjectLocation_001 = new leenkx.logicnode.GetLocationNode(this);
|
||||
_GetObjectLocation_001.preallocInputs(2);
|
||||
_GetObjectLocation_001.preallocOutputs(1);
|
||||
leenkx.logicnode.LogicNode.addLink(new leenkx.logicnode.ObjectNode(this, ""), _GetObjectLocation_001, 0, 0);
|
||||
leenkx.logicnode.LogicNode.addLink(new leenkx.logicnode.BooleanNode(this, false), _GetObjectLocation_001, 0, 1);
|
||||
var _SeparateXYZ = new leenkx.logicnode.SeparateVectorNode(this);
|
||||
_SeparateXYZ.preallocInputs(1);
|
||||
_SeparateXYZ.preallocOutputs(3);
|
||||
leenkx.logicnode.LogicNode.addLink(_GetObjectLocation_001, _SeparateXYZ, 0, 0);
|
||||
leenkx.logicnode.LogicNode.addLink(_SeparateXYZ, new leenkx.logicnode.FloatNode(this, 0.0), 0, 0);
|
||||
var _SetObjectLocation_001 = new leenkx.logicnode.SetLocationNode(this);
|
||||
_SetObjectLocation_001.preallocInputs(4);
|
||||
_SetObjectLocation_001.preallocOutputs(1);
|
||||
var _OnUpdate = new leenkx.logicnode.OnUpdateNode(this);
|
||||
_OnUpdate.property0 = "Update";
|
||||
_OnUpdate.preallocInputs(0);
|
||||
_OnUpdate.preallocOutputs(1);
|
||||
leenkx.logicnode.LogicNode.addLink(_OnUpdate, _SetObjectLocation_001, 0, 0);
|
||||
leenkx.logicnode.LogicNode.addLink(new leenkx.logicnode.ObjectNode(this, ""), _SetObjectLocation_001, 0, 1);
|
||||
var _Vector = new leenkx.logicnode.VectorNode(this);
|
||||
_Vector.preallocInputs(3);
|
||||
_Vector.preallocOutputs(1);
|
||||
var _Math = new leenkx.logicnode.MathNode(this);
|
||||
_Math.property0 = "Multiply";
|
||||
_Math.property1 = false;
|
||||
_Math.preallocInputs(2);
|
||||
_Math.preallocOutputs(1);
|
||||
var _Math_001 = new leenkx.logicnode.MathNode(this);
|
||||
_Math_001.property0 = "Sine";
|
||||
_Math_001.property1 = false;
|
||||
_Math_001.preallocInputs(1);
|
||||
_Math_001.preallocOutputs(1);
|
||||
var _GetApplicationTime = new leenkx.logicnode.TimeNode(this);
|
||||
_GetApplicationTime.preallocInputs(0);
|
||||
_GetApplicationTime.preallocOutputs(3);
|
||||
leenkx.logicnode.LogicNode.addLink(_GetApplicationTime, new leenkx.logicnode.FloatNode(this, 0.0), 1, 0);
|
||||
leenkx.logicnode.LogicNode.addLink(_GetApplicationTime, new leenkx.logicnode.FloatNode(this, 0.0), 2, 0);
|
||||
leenkx.logicnode.LogicNode.addLink(_GetApplicationTime, _Math_001, 0, 0);
|
||||
leenkx.logicnode.LogicNode.addLink(_Math_001, _Math, 0, 0);
|
||||
leenkx.logicnode.LogicNode.addLink(new leenkx.logicnode.FloatNode(this, 4.0), _Math, 0, 1);
|
||||
leenkx.logicnode.LogicNode.addLink(_Math, _Vector, 0, 0);
|
||||
leenkx.logicnode.LogicNode.addLink(_SeparateXYZ, _Vector, 1, 1);
|
||||
leenkx.logicnode.LogicNode.addLink(_SeparateXYZ, _Vector, 2, 2);
|
||||
leenkx.logicnode.LogicNode.addLink(_Vector, _SetObjectLocation_001, 0, 2);
|
||||
leenkx.logicnode.LogicNode.addLink(new leenkx.logicnode.BooleanNode(this, false), _SetObjectLocation_001, 0, 3);
|
||||
leenkx.logicnode.LogicNode.addLink(_SetObjectLocation_001, new leenkx.logicnode.NullNode(this), 0, 0);
|
||||
}
|
||||
}
|
||||
BIN
playground/playground.blend
Normal file
BIN
playground/playground.blend
Normal file
Binary file not shown.
Reference in New Issue
Block a user