🤑 Indie game store🙌 Free games😂 Fun games😨 Horror games
👷 Game development🎨 Assets📚 Comics
🎉 Sales🎁 Bundles

Create dynamically Actors

A topic by Schreda created Mar 07, 2016 Views: 678 Replies: 4
Viewing posts 1 to 5


First of all I really like the this engine. Especially because of the extensibility... Based on the easy handling json structure you can put every kind of engine in it. Another thing I like about this engine is the great editor. Because its possible to easily add stuff and orientate.

But now lets turn to my question. Can someone maybe be so kind and show me an example how I can add dynamically objects to a scene. I tried already some stuff but it seems nothing is working... I worked previously with phaserjs, threejs, cocos2dx, SDL, but I miss something like append/addObject. Whats the proper way in that case?




Hello! You can create new actors almost entirely from scratch, like so:

// Create an actor with code.
let newActor = new Sup.Actor("ANY NAME YOU WANT");

// You can add a behavior if you want it to do something.

// This adds a new sprite renderer to the actor. You can add modelRenderers, and textRenderers too!
new Sup.SpriteRenderer(newActor, "SPRITE/PATH/GOES/HERE");

// You must set it's position in order for it to appear.
newActor.setPosition(0, 0, 0);

Or alternatively, if you've already made a prefab you can just append it to the scene:

// Add an already defined actor type to the current scene.
let newActor = Sup.appendScene("PREFAB/PATH/GOES/HERE");

// You must set it's position in order for it to appear.
newActor.setPosition(0, 0, 0);

Hopefully this helps :D

Thanks for your feedback. I would have one more question. I would like to add an CubicModelRenderer but I dont understand what means the inner param within the Sup.CubicModel("...") constructor?

let newActor: Sup.Actor = new Sup.Actor("ANY NAME YOU WANT");

let cubicModel: Sup.CubicModel = new Sup.CubicModel("asd");

new Sup.CubicModelRenderer(newActor, cubicModel, Sup.CubicModelRenderer.MaterialType.Basic);

newActor.setPosition(0, 0, -3);

Best regards


The string within the CubicModel constructor is the location of the CubicModel you've created.

For example, if you've created a CubicModel in the Models folder called 'MyModel' you'd write:

let cubicModel = new Sup.CubicModel("Models/MyModel");

Thanks a lot found it :D