The object classes that are planned are as follows:
Here is a sample of an actor.Actor
Logic
Debris
2D Sound
3D Sound
Terrain
Armor
ParticleEmitter
Light
Item
Weapon
WheeledVehicle
Trigger
Player
Precipitation
Decal
Lightning
Camera
Splash
SpawnMarker
Code: Select all
// Use only predefined fields for now. The Actor class will look only at the predefined fields. The dynamic fields can be access only in script using obj->getDataAs<Type>() functions.
Merlin <- {
className = "Actor",
meshName = "merlin.mesh",
hp = 100,
mp = 50
}
function Merlin::onCreate(obj)
{
print("Initializing Merlin...");
}
function Merlin::onCollision(obj)
{
print("collide!!");
local h = obj.getDataAsInt("hp");
h -= 20;
obj.setDataInt("hp", 20);
print(obj.getDataAsInt("hp"));
}
RFRegisterObjectType("Merlin");
Code: Select all
m = RFActor("Merlin01", "Merlin"); // First param is the name, second is the instance data table
hp = m.getDataAsInt("hp");
print("Merlin\'s HP is " + hp);
Code: Select all
m = RFGetWorld().getObject("Merlin01");
m.suicide(); // Let's kill Merlin
I'd like constructive input on this. I'm mainly looking for ways I can improve it.