Add area and flag on physics
This commit is contained in:
@@ -34,6 +34,19 @@ errorret_t gameInit(void) {
|
||||
assetUnlockEntry(sceneEntry);
|
||||
errorChain(ret);
|
||||
|
||||
// Test-only: print a debug message whenever an entity enters "testArea"
|
||||
// (see assets/scenes/test.json), exercising the TRIGGER component.
|
||||
entitymanager_t *mgr = sceneGetEntities(testSceneId);
|
||||
entityid_t testAreaEntity = entityFindByName(mgr, "testArea");
|
||||
if(testAreaEntity != ENTITY_ID_INVALID) {
|
||||
componentid_t testAreaTrig = entityGetComponent(
|
||||
mgr, testAreaEntity, COMPONENT_TYPE_TRIGGER
|
||||
);
|
||||
entityTriggerOnEnterAdd(
|
||||
mgr, testAreaEntity, testAreaTrig, gameTestAreaOnEnter, NULL
|
||||
);
|
||||
}
|
||||
|
||||
sceneSetActive(testSceneId);
|
||||
errorOk();
|
||||
}
|
||||
@@ -45,3 +58,14 @@ errorret_t gameUpdate(void) {
|
||||
errorret_t gameDispose(void) {
|
||||
errorOk();
|
||||
}
|
||||
|
||||
void gameTestAreaOnEnter(
|
||||
entitymanager_t *mgr,
|
||||
const entityid_t triggerEntityId,
|
||||
const componentid_t triggerComponentId,
|
||||
const entityid_t otherEntityId,
|
||||
const componentid_t otherComponentId,
|
||||
void *user
|
||||
) {
|
||||
logDebug("testArea: entity %d entered", otherEntityId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user