diff --git a/GameEngine/resources/GameEngineTest.model b/GameEngine/resources/GameEngineTest.model index f1ee23b..3199a45 100644 --- a/GameEngine/resources/GameEngineTest.model +++ b/GameEngine/resources/GameEngineTest.model @@ -1,52 +1,87 @@ init { -scene := { - "entities": { - "001": { - "transform": { - "rotation": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "scale": { - "x": 1.0, - "y": 1.0, - "z": 1.0 - }, - "position": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - } +enemy := { + "001": { + "transform": { + "rotation": { + "x": 0.0, + "y": 0.0, + "z": 0.0 }, - "mesh": { - "sprite": "GameEngine/resources/enemy1.png", - "type": "sprite" + "scale": { + "x": 1.0, + "y": 1.0, + "z": 1.0 + }, + "position": { + "x": 0.0, + "y": 0.0, + "z": 0.0 } }, - "002": { - "transform": { - "rotation": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "scale": { - "x": 1.0, - "y": 1.0, - "z": 1.0 - }, - "position": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - } - }, - "mesh": { - "sprite": "GameEngine/resources/enemy1.png", - "type": "sprite" - } + "move": { + "type": straight, + "speed": 5.0 + }, + "mesh": { + "sprite": "GameEngine/resources/enemy1.png", + "type": "sprite" } + }, + "002": { + "transform": { + "rotation": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "scale": { + "x": 1.0, + "y": 1.0, + "z": 1.0 + }, + "position": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + } + }, + "move": { + "type": straight, + "speed": 5.0 + }, + "mesh": { + "sprite": "GameEngine/resources/enemy1.png", + "type": "sprite" + } + } +} +player := { + "transform": { + "rotation": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "scale": { + "x": 1.0, + "y": 1.0, + "z": 1.0 + }, + "position": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + } + }, + "mesh": { + "sprite": "GameEngine/resources/enemy1.png", + "type": "sprite" + } +} +timers := { + "000": { + "count": 0, + "interval": 100 } } } @@ -56,6 +91,14 @@ native channel SceneUpdateEvent { out scene.time(time:Long,updateEvent(dt:Long)) = (time+dt) } +channel RotateEnemy(eid:Str) { + in enemies.{eid:Str}.transform.rotation(curRot:Json,rotateEnemy(nextRot)) = nextRot + out enemies.{eid:Str}.transform.rotation(curRot:Json,rotateEnemy(nextRot)) = nextRot +} +channel MoveEnemy(eid:Str) { + in enemies.{eid:Str}.transform.position(curPos:Json,moveEnemy(nextPos)) = nextPos + out scene.entities.{eid:Str}.transform.position(curPos:Json,moveEnemy(nextPos)) = nextPos +} native channel TimerEvent(tid:Str) { out timers.{tid:Str}.count(count:Long,tick()) = (count+1) } @@ -75,9 +118,17 @@ native channel EntityScaleUpdate(eid:Str) { in scene.entities.{eid:Str}.transform.scale(curScale:Json,updateScale(nextScale.x,nextScale.y,nextScale.z)) = nextScale } +channel RotateEnemy(eid:Str) { + in enemies.{eid:Str}.transform.rotation(curRot:Json,rotateEnemy(nextRot)) = nextRot + out enemies.{eid:Str}.transform.rotation(curRot:Json,rotateEnemy(nextRot)) = nextRot +} native channel EntityPositionUpdate(eid:Str) { in scene.entities.{eid:Str}.transform.position(curPos:Json,updatePosition(nextPos.x,nextPos.y,nextPos.z)) = nextPos } +channel MoveEnemy(eid:Str) { + in enemies.{eid:Str}.transform.position(curPos:Json,moveEnemy(nextPos)) = nextPos + out scene.entities.{eid:Str}.transform.position(curPos:Json,moveEnemy(nextPos)) = nextPos +} native channel CameraProjectionUpdate { in scene.camera.projection(curProj:Json,updateProjection(curProj,nextProj)) = nextProj }